Skip to content
Snippets Groups Projects
Commit d336f606 authored by Florent Thiery's avatar Florent Thiery
Browse files

compare last backup date with today, refs #20687

parent 77d1d876
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ import os
import sys
import subprocess
import imp
from datetime import datetime
os.chdir(os.path.dirname(__file__))
......@@ -21,8 +22,13 @@ def test_last_backup_is_recent(server, client):
cmd = 'ssh %s ls -l %s | grep current' % (server, path)
status, out = subprocess.getstatusoutput(cmd)
if status == 0:
date = out.strip().split(' ')[-1]
print(date)
date = out.strip().split(' ')[-2]
pdate = datetime.strptime(date, '%Y-%m-%d')
if datetime.now() - pdate > 2:
print('Backup is older than 2 days')
return False
else:
return True
else:
return False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment