Handle errors on tasks correctly with a die,
authorRené Jochum <r.jochum@proxmox.com>
Wed, 20 Jun 2018 09:46:55 +0000 (11:46 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 20 Jun 2018 10:29:23 +0000 (12:29 +0200)
so we get the correct exit code on errors.

Signed-off-by: René Jochum <r.jochum@proxmox.com>
PVE/APIClient/Helpers.pm

index 7d855ec..5c2e4cb 100644 (file)
@@ -355,6 +355,10 @@ sub poll_task {
        sleep(2);
     }
 
+    if ($task_status->{exitstatus} ne "OK") {
+       die $task_status->{exitstatus};
+    }
+
     return $task_status->{exitstatus};
 }