Skip to content

Commit

Permalink
Merge pull request #1103 from ksamoray/manager_cluster_err
Browse files Browse the repository at this point in the history
Handle errors on manager_cluster resource properly
  • Loading branch information
ksamoray authored Feb 11, 2024
2 parents 31bac2a + e3068cb commit 8c0081c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nsxt/resource_nsxt_manager_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func resourceNsxtManagerClusterCreate(d *schema.ResourceData, m interface{}) err
for _, guestNode := range nodes {
err := joinNodeToCluster(clusterID, certSha256Thumbprint, guestNode, hostIPs, d, m)
if err != nil {
return handleCreateError("ManagerCluster", clusterID, fmt.Errorf("failed to join node %s: %s", guestNode.ID, err))
return handleCreateError("ManagerCluster", clusterID, err)
}
}
d.SetId(clusterID)
Expand Down Expand Up @@ -356,7 +356,7 @@ func joinNodeToCluster(clusterID string, certSha256Thumbprint string, guestNode
}
_, err = client.Joincluster(joinClusterParams)
if err != nil {
return fmt.Errorf("Failed to join node to cluster: %s, node ip address: %s", err, guestNode.IPAddress)
return logAPIError(fmt.Sprintf("Failed to join node to cluster: %s, node ip address: %s", clusterID, guestNode.IPAddress), err)
}
log.Printf("[INFO] Cluster %s. Completed join node %s", clusterID, guestNode.IPAddress)
return nil
Expand Down

0 comments on commit 8c0081c

Please sign in to comment.