mirror of
https://github.com/netinvent/npbackup.git
synced 2025-11-10 06:01:39 +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.minimum_backup_age = None
|
||||||
self._exec_time = None
|
self._exec_time = None
|
||||||
|
|
||||||
self._using_dev_binary = False
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def repo_config(self) -> dict:
|
def repo_config(self) -> dict:
|
||||||
return self._repo_config
|
return self._repo_config
|
||||||
|
|
@ -556,11 +554,11 @@ class NPBackupRunner:
|
||||||
arch = os_arch()
|
arch = os_arch()
|
||||||
binary = get_restic_internal_binary(arch)
|
binary = get_restic_internal_binary(arch)
|
||||||
if binary:
|
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
|
self.restic_runner.binary = binary
|
||||||
|
version = self.restic_runner.binary_version
|
||||||
|
self.write_logs(f"Using dev binary {version}", level="info")
|
||||||
else:
|
else:
|
||||||
|
self._is_ready = False
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
@ -684,9 +682,12 @@ class NPBackupRunner:
|
||||||
if self.json_output:
|
if self.json_output:
|
||||||
if backend_js:
|
if backend_js:
|
||||||
js = backend_js
|
js = backend_js
|
||||||
js = {
|
if isinstance(result, dict):
|
||||||
"result": result,
|
js = result
|
||||||
}
|
else:
|
||||||
|
js = {
|
||||||
|
"result": result,
|
||||||
|
}
|
||||||
if warnings:
|
if warnings:
|
||||||
js["warnings"] = warnings
|
js["warnings"] = warnings
|
||||||
if result:
|
if result:
|
||||||
|
|
@ -1017,6 +1018,7 @@ class NPBackupRunner:
|
||||||
self.write_logs(f"Restic output:\n{self.restic_runner.backup_result_content}", level="debug")
|
self.write_logs(f"Restic output:\n{self.restic_runner.backup_result_content}", level="debug")
|
||||||
# Extract backup size from result_string
|
# 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(
|
metrics_analyzer_result = metric_writer(
|
||||||
self.repo_config, result, self.restic_runner.backup_result_content, self.restic_runner.dry_run
|
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
|
is_cloud_error = False
|
||||||
if is_cloud_error is True:
|
if is_cloud_error is True:
|
||||||
|
self.last_command_status = True
|
||||||
return True, output
|
return True, output
|
||||||
else:
|
else:
|
||||||
self.write_logs("Some files could not be backed up", level="error")
|
self.write_logs("Some files could not be backed up", level="error")
|
||||||
|
|
@ -785,7 +786,9 @@ class ResticRunner:
|
||||||
if additional_backup_only_parameters:
|
if additional_backup_only_parameters:
|
||||||
cmd += " {}".format(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:
|
if read_from_stdin:
|
||||||
result, output = self.executor(cmd, stdin=sys.stdin.buffer)
|
result, output = self.executor(cmd, stdin=sys.stdin.buffer)
|
||||||
else:
|
else:
|
||||||
|
|
@ -800,7 +803,7 @@ class ResticRunner:
|
||||||
"VSS cannot be used. Backup will be done without VSS.", level="error"
|
"VSS cannot be used. Backup will be done without VSS.", level="error"
|
||||||
)
|
)
|
||||||
result, output = self.executor(cmd.replace(" --use-fs-snapshot", ""))
|
result, output = self.executor(cmd.replace(" --use-fs-snapshot", ""))
|
||||||
|
self.json_output = json_output
|
||||||
if result:
|
if result:
|
||||||
msg = "Backend finished backup with success"
|
msg = "Backend finished backup with success"
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue