Now we make an additional request on `api2/json/.../tasks/{upid}/status` to
get the `exitstatus` of the task. This allows us to `bail` and thus
get a non-zero exit code in the cli.
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
}
}
+ 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");
+ }
+
Ok(())
};