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

only try to descend into folders, refs #21677

parent 5ebb14b8
No related branches found
No related tags found
No related merge requests found
...@@ -70,22 +70,24 @@ def test_backup_space(server): ...@@ -70,22 +70,24 @@ def test_backup_space(server):
def check_local_backup(path): def check_local_backup(path):
all_ok = True all_ok = True
for d in os.listdir(path): for d in os.listdir(path):
subd = os.path.join(path, d) if os.path.isdir(d):
latest = os.path.join(subd, 'latest') subd = os.path.join(path, d)
if os.path.exists(latest): latest = os.path.join(subd, 'latest')
mtime = os.path.getmtime(latest) if os.path.exists(latest):
d = datetime.fromtimestamp(mtime) mtime = os.path.getmtime(latest)
now = datetime.now() d = datetime.fromtimestamp(mtime)
diff_seconds = (now - d).total_seconds() now = datetime.now()
if diff_seconds > 25*3600: diff_seconds = (now - d).total_seconds()
print('Backup %s is older than a day' % subd) if diff_seconds > 25*3600:
all_ok = False print('Backup %s is older than a day' % subd)
all_ok = False
else:
print('Backup %s is fine' % subd)
else: else:
print('Backup %s is fine' % subd) for dd in os.listdir(subd):
else: if os.path.isdir(dd):
for dd in os.listdir(subd): subsubd = os.path.join(subd, dd)
subsubd = os.path.join(subd, dd) all_ok = min(all_ok, check_local_backup(subsubd))
all_ok = min(all_ok, check_local_backup(subsubd))
return all_ok return all_ok
......
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