use print_warning also in borg delete ::archive --force --force

This commit is contained in:
Thomas Waldmann 2023-11-12 18:35:25 +01:00
parent 9de07ebd46
commit bec02a36c8
No known key found for this signature in database
GPG Key ID: 243ACFA951F78E01
2 changed files with 5 additions and 6 deletions

View File

@ -37,8 +37,7 @@ class DeleteMixIn:
try:
current_archive = manifest.archives.pop(archive_name)
except KeyError:
self.exit_code = EXIT_WARNING
logger.warning(f"Archive {archive_name} not found ({i}/{len(archive_names)}).")
self.print_warning(f"Archive {archive_name} not found ({i}/{len(archive_names)}).")
else:
deleted = True
if self.output_list:
@ -50,9 +49,9 @@ class DeleteMixIn:
manifest.write()
# note: might crash in compact() after committing the repo
repository.commit(compact=False)
logger.warning('Done. Run "borg check --repair" to clean up the mess.')
self.print_warning('Done. Run "borg check --repair" to clean up the mess.')
else:
logger.warning("Aborted.")
self.print_warning("Aborted.")
return self.exit_code
stats = Statistics(iec=args.iec)
@ -73,7 +72,7 @@ class DeleteMixIn:
try:
archive_info = manifest.archives[archive_name]
except KeyError:
logger.warning(msg_not_found.format(archive_name, i, len(archive_names)))
self.print_warning(msg_not_found.format(archive_name, i, len(archive_names)))
else:
if self.output_list:
logger_list.info(msg_delete.format(format_archive(archive_info), i, len(archive_names)))

View File

@ -76,7 +76,7 @@ def test_delete_double_force(archivers, request):
id = archive.metadata.items[0]
repository.put(id, b"corrupted items metadata stream chunk")
repository.commit(compact=False)
cmd(archiver, "delete", "-a", "test", "--force", "--force")
cmd(archiver, "delete", "-a", "test", "--force", "--force", exit_code=1)
cmd(archiver, "check", "--repair")
output = cmd(archiver, "rlist")
assert "test" not in output