Skip to content

Commit

Permalink
Handle errors on manager_cluster resource properly
Browse files Browse the repository at this point in the history
Output messages weren't outputed properly from provider.

Signed-off-by: Kobi Samoray <[email protected]>
  • Loading branch information
ksamoray committed Feb 8, 2024
1 parent 1174ffd commit e3068cb
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 e3068cb

Please sign in to comment.