mirror of
https://github.com/netinvent/npbackup.git
synced 2025-10-29 06:46:26 +08:00
Various JS / backend binary fixes
This commit is contained in:
parent
07f2972520
commit
ad0785f3eb
2 changed files with 15 additions and 10 deletions
|
|
@ -139,8 +139,6 @@ class NPBackupRunner:
|
|||
self.minimum_backup_age = None
|
||||
self._exec_time = None
|
||||
|
||||
self._using_dev_binary = False
|
||||
|
||||
@property
|
||||
def repo_config(self) -> dict:
|
||||
return self._repo_config
|
||||
|
|
@ -556,11 +554,11 @@ class NPBackupRunner:
|
|||
arch = os_arch()
|
||||
binary = get_restic_internal_binary(arch)
|
||||
if binary:
|
||||
if not self._using_dev_binary:
|
||||
self._using_dev_binary = True
|
||||
self.write_logs("Using dev binary !", level="info")
|
||||
self.restic_runner.binary = binary
|
||||
version = self.restic_runner.binary_version
|
||||
self.write_logs(f"Using dev binary {version}", level="info")
|
||||
else:
|
||||
self._is_ready = False
|
||||
return False
|
||||
return True
|
||||
|
||||
|
|
@ -684,9 +682,12 @@ class NPBackupRunner:
|
|||
if self.json_output:
|
||||
if backend_js:
|
||||
js = backend_js
|
||||
js = {
|
||||
"result": result,
|
||||
}
|
||||
if isinstance(result, dict):
|
||||
js = result
|
||||
else:
|
||||
js = {
|
||||
"result": result,
|
||||
}
|
||||
if warnings:
|
||||
js["warnings"] = warnings
|
||||
if result:
|
||||
|
|
@ -1017,6 +1018,7 @@ class NPBackupRunner:
|
|||
self.write_logs(f"Restic output:\n{self.restic_runner.backup_result_content}", level="debug")
|
||||
# Extract backup size from result_string
|
||||
|
||||
# Metrics will not be in json format, since we need to diag cloud issues until
|
||||
metrics_analyzer_result = metric_writer(
|
||||
self.repo_config, result, self.restic_runner.backup_result_content, self.restic_runner.dry_run
|
||||
)
|
||||
|
|
|
|||
|
|
@ -318,6 +318,7 @@ class ResticRunner:
|
|||
):
|
||||
is_cloud_error = False
|
||||
if is_cloud_error is True:
|
||||
self.last_command_status = True
|
||||
return True, output
|
||||
else:
|
||||
self.write_logs("Some files could not be backed up", level="error")
|
||||
|
|
@ -785,7 +786,9 @@ class ResticRunner:
|
|||
if additional_backup_only_parameters:
|
||||
cmd += " {}".format(additional_backup_only_parameters)
|
||||
|
||||
# Run backup
|
||||
# Run backup without json output, as we could not compute the cloud errors in json output via regexes
|
||||
json_output = self.json_output
|
||||
self.json_output = False
|
||||
if read_from_stdin:
|
||||
result, output = self.executor(cmd, stdin=sys.stdin.buffer)
|
||||
else:
|
||||
|
|
@ -800,7 +803,7 @@ class ResticRunner:
|
|||
"VSS cannot be used. Backup will be done without VSS.", level="error"
|
||||
)
|
||||
result, output = self.executor(cmd.replace(" --use-fs-snapshot", ""))
|
||||
|
||||
self.json_output = json_output
|
||||
if result:
|
||||
msg = "Backend finished backup with success"
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue