mirror of
https://github.com/netinvent/npbackup.git
synced 2024-11-11 01:28:50 +08:00
Runner: group_runner is now json compatible
This commit is contained in:
parent
ccf16ca12e
commit
04bc7b6a1d
1 changed files with 16 additions and 7 deletions
|
@ -1314,11 +1314,16 @@ class NPBackupRunner:
|
|||
},
|
||||
}
|
||||
|
||||
js = {"result": None, "details": []}
|
||||
|
||||
for repo_config in repo_config_list:
|
||||
repo_name = repo_config.g("name")
|
||||
self.write_logs(f"Running {operation} for repo {repo_name}", level="info")
|
||||
self.repo_config = repo_config
|
||||
result = self.__getattribute__(operation)(**kwargs)
|
||||
if self.json_output:
|
||||
js["details"].append({repo_name: result})
|
||||
else:
|
||||
if result:
|
||||
self.write_logs(
|
||||
f"Finished {operation} for repo {repo_name}", level="info"
|
||||
|
@ -1327,6 +1332,10 @@ class NPBackupRunner:
|
|||
self.write_logs(
|
||||
f"Operation {operation} failed for repo {repo_name}", level="error"
|
||||
)
|
||||
if not result:
|
||||
group_result = False
|
||||
self.write_logs("Finished execution group operations", level="info")
|
||||
if self.json_output:
|
||||
js["result"] = group_result
|
||||
return js
|
||||
return group_result
|
||||
|
|
Loading…
Reference in a new issue