Skip to content
Snippets Groups Projects
Commit 76d5f146 authored by Florent Thiéry's avatar Florent Thiéry
Browse files

cleanup all folders and not just one by one refs #23246

parent e302e397
No related branches found
No related tags found
No related merge requests found
...@@ -81,17 +81,17 @@ def test_backup_space(server=None, path="/backup"): ...@@ -81,17 +81,17 @@ def test_backup_space(server=None, path="/backup"):
def check_backup_is_incremental(path): def check_backup_is_incremental(path):
# incremental backups done with tmbackup mean that they will all at least contain links # incremental backups done with tmbackup mean that they will all at least contain links
dirs = os.listdir(path) dirs = os.listdir(path)
is_incremental = True
for d in dirs: for d in dirs:
files_count = 0 files_count = 0
folder_path = os.path.join(path, d) folder_path = os.path.join(path, d)
if os.path.isdir(folder_path): if os.path.isdir(folder_path):
files_count = len(os.listdir(folder_path)) files_count = len(os.listdir(folder_path))
if files_count == 0: if files_count == 0:
print('Folder %s is empty, this indicates non-incremental backups (we are expecting links)' % folder_path) print('Folder %s is empty, this indicates non-incremental backups (we are expecting links), removing folder' % folder_path)
is_incremental = False
os.rmdir(folder_path) os.rmdir(folder_path)
print('Folder removed') return is_incremental
return False
return True
def check_local_backup(path): def check_local_backup(path):
......
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