mirror of
https://github.com/netinvent/npbackup.git
synced 2024-09-21 07:16:16 +08:00
Fix has_recent_snapshot output without json
This commit is contained in:
parent
b8c75b35d3
commit
fca5343f52
|
@ -782,18 +782,16 @@ class NPBackupRunner:
|
|||
)
|
||||
# Temporarily disable verbose and enable json result
|
||||
self.restic_runner.verbose = False
|
||||
json_output = self.restic_runner.json_output
|
||||
self.restic_runner.json_output = True
|
||||
data = self.restic_runner.has_recent_snapshot(
|
||||
self.minimum_backup_age
|
||||
)
|
||||
self.restic_runner.verbose = self.verbose
|
||||
self.restic_runner.json_output = json_output
|
||||
if self.json_output:
|
||||
return data
|
||||
|
||||
result = data["result"]
|
||||
backup_tz = data["output"]
|
||||
|
||||
# has_recent_snapshot returns a tuple when not self.json_output
|
||||
result = data[0]
|
||||
backup_tz = data[1]
|
||||
if result:
|
||||
self.write_logs(
|
||||
f"Most recent backup in repo {self.repo_config.g('name')} is from {backup_tz}",
|
||||
|
|
|
@ -1074,8 +1074,10 @@ class ResticRunner:
|
|||
return False, None
|
||||
try:
|
||||
# Make sure we run with json support for this one
|
||||
|
||||
json_output = self.json_output
|
||||
self.json_output = True
|
||||
result = self.snapshots()
|
||||
self.json_output = json_output
|
||||
if self.last_command_status is False:
|
||||
if self.json_output:
|
||||
msg = "Could not check for snapshots"
|
||||
|
|
Loading…
Reference in a new issue