Runner: group_runner is now json compatible

This commit is contained in:
deajan 2024-04-18 00:39:42 +02:00
parent ccf16ca12e
commit 04bc7b6a1d

View file

@ -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