client: do exit with failure code when task finished with warnings
Warnings in the task log/state normally means that the task actually did its main job, but there was some detected (potential) issue that the users should be made aware of. Exiting with an error code in that case would be a bit odd. While just exiting with success might not be the best solution either, it's definitively more correct than a failure-exit-code, so go for that for now as a stop-gap. Signed-off-by: Gabriel Goller <g.goller@proxmox.com> [ TL: rebased on current master (v3 was already applied) and rewrite commit message accordingly ] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
48fbce07df
commit
af7b07479b
@ -98,10 +98,12 @@ pub async fn display_task_log(
|
||||
|
||||
let status_path = format!("api2/json/nodes/localhost/tasks/{upid_encoded}/status");
|
||||
let status_result = client.get(&status_path, None).await?;
|
||||
if status_result["data"]["status"].as_str() == Some("stopped")
|
||||
&& status_result["data"]["exitstatus"].as_str() != Some("OK")
|
||||
{
|
||||
bail!("task failed");
|
||||
if status_result["data"]["status"].as_str() == Some("stopped") {
|
||||
if let Some(status) = status_result["data"]["exitstatus"].as_str() {
|
||||
if status != "OK" && !status.starts_with("WARNINGS") {
|
||||
bail!("task failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
Loading…
x
Reference in New Issue
Block a user