]> git.proxmox.com Git - proxmox-backup.git/blobdiff - pbs-client/src/task_log.rs
fix #4343: updated `view_task_result` to bail on task failure
[proxmox-backup.git] / pbs-client / src / task_log.rs
index 0bbb928df75be3c98d127e4e302644d9151837d2..709d0d088d51330806d1c669eb0241593cd8b3a7 100644 (file)
@@ -96,6 +96,14 @@ 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");
+        }
+
         Ok(())
     };