Don't check for recent backup if --force is goven

This commit is contained in:
deajan 2024-06-11 22:18:50 +02:00
parent 729a2a7c1f
commit c0c3cb78b4

View file

@ -1076,19 +1076,20 @@ class NPBackupRunner:
"backup_opts.additional_backup_only_parameters" "backup_opts.additional_backup_only_parameters"
) )
if not force:
# Check if backup is required, no need to be verbose, but we'll make sure we don't get a json result here # Check if backup is required, no need to be verbose, but we'll make sure we don't get a json result here
self.restic_runner.verbose = False self.restic_runner.verbose = False
json_output = self.json_output json_output = self.json_output
self.json_output = False self.json_output = False
# Since we don't want to close queues nor create a subthread, we need to change behavior here # Since we don't want to close queues nor create a subthread, we need to change behavior here
# pylint: disable=E1123 (unexpected-keyword-arg) # pylint: disable=E1123 (unexpected-keyword-arg)
has_recent_snapshots, backup_tz = self.has_recent_snapshot( has_recent_snapshots, _ = self.has_recent_snapshot(
__close_queues=False, __no_threads=True __close_queues=False, __no_threads=True
) )
self.json_output = json_output self.json_output = json_output
# We also need to "reapply" the json setting to backend # We also need to "reapply" the json setting to backend
self.restic_runner.json_output = json_output self.restic_runner.json_output = json_output
if has_recent_snapshots and not force: if has_recent_snapshots:
msg = "No backup necessary" msg = "No backup necessary"
self.write_logs(msg, level="info") self.write_logs(msg, level="info")
return self.convert_to_json_output(True, msg) return self.convert_to_json_output(True, msg)