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):
def check_local_backup(path):
all_ok = True
for d in os.listdir(path):
subd = os.path.join(path, d)
latest = os.path.join(subd, 'latest')
if os.path.exists(latest):
mtime = os.path.getmtime(latest)
d = datetime.fromtimestamp(mtime)
now = datetime.now()
diff_seconds = (now - d).total_seconds()
if diff_seconds > 25*3600:
print('Backup %s is older than a day' % subd)
all_ok = False
if os.path.isdir(d):
subd = os.path.join(path, d)
latest = os.path.join(subd, 'latest')
if os.path.exists(latest):
mtime = os.path.getmtime(latest)
d = datetime.fromtimestamp(mtime)
now = datetime.now()
diff_seconds = (now - d).total_seconds()
if diff_seconds > 25*3600:
print('Backup %s is older than a day' % subd)
all_ok = False
else:
print('Backup %s is fine' % subd)
else:
print('Backup %s is fine' % subd)
else:
for dd in os.listdir(subd):
subsubd = os.path.join(subd, dd)
all_ok = min(all_ok, check_local_backup(subsubd))
for dd in os.listdir(subd):
if os.path.isdir(dd):
subsubd = os.path.join(subd, dd)
all_ok = min(all_ok, check_local_backup(subsubd))
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