Skip to content

Commit

Permalink
fix check on cluster_uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxtof committed Aug 17, 2023
1 parent aa5bdde commit d302909
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions builder/nutanix/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
}

// Validate Cluster Name
if c.VmConfig.ClusterName == "" {
log.Println("Nutanix Cluster Name missing from configuration")
errs = packersdk.MultiErrorAppend(errs, fmt.Errorf("missing cluster_name"))
if c.VmConfig.ClusterName == "" && c.VmConfig.ClusterUUID == "" {
log.Println("Nutanix Cluster Name or UUID missing from configuration")
errs = packersdk.MultiErrorAppend(errs, fmt.Errorf("missing cluster_name or cluster_uuid"))
}

// Validate VM disks
Expand Down
2 changes: 1 addition & 1 deletion builder/nutanix/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ func (d *NutanixDriver) CreateRequest(vm VmConfig, state multistep.StateBag) (*v
if err != nil {
return nil, fmt.Errorf("error while GetCluster, %s", err.Error())
}
} else if vm.ClusterName != "" {
} else {
cluster, err = findClusterByName(conn, vm.ClusterName)
if err != nil {
return nil, fmt.Errorf("error while findClusterByName, %s", err.Error())
Expand Down

0 comments on commit d302909

Please sign in to comment.