From d70b1e70848e06e3b1f9df7070fc45cc305f802c Mon Sep 17 00:00:00 2001 From: faiq Date: Wed, 5 Jun 2024 21:43:10 -0600 Subject: [PATCH] fix: panic during power off --- builder/nutanix/driver.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/builder/nutanix/driver.go b/builder/nutanix/driver.go index 2c57a58..aa722a0 100644 --- a/builder/nutanix/driver.go +++ b/builder/nutanix/driver.go @@ -930,14 +930,16 @@ func (d *NutanixDriver) PowerOff(vmUUID string) error { <-time.After(1 * time.Second) continue } - return fmt.Errorf("error while GetTask, %s", err.Error()) + if err != nil { + return fmt.Errorf("error while GetTask, %s", err.Error()) + } } log.Printf("PowerOff task: %s", taskUUID) return nil } -func (d *NutanixDriver) SaveVMDisk(diskUUID string, index int, imageCategories []Category) (*nutanixImage, error) { +func (d *NutanixDriver) SaveVMDisk(diskUUID string, index int, imageCategories []Category) (*nutanixImage, error) { configCreds := client.Credentials{ URL: fmt.Sprintf("%s:%d", d.ClusterConfig.Endpoint, d.ClusterConfig.Port), Endpoint: d.ClusterConfig.Endpoint,