Skip to content

Commit

Permalink
Merge pull request #49 from spectrocloud/PLT-595-1
Browse files Browse the repository at this point in the history
PLT-595: Improve error handling when checking PCG status.
  • Loading branch information
nikchern authored Aug 1, 2023
2 parents aa88e55 + 4422325 commit 340c078
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/private_cloud_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,15 @@ func (h *V1Client) CheckPCG(PcgId string) error {
}
if pcg == nil {
return fmt.Errorf("Private Cloud Gateway not found: %s", PcgId)
} else if pcg.Status.State != "Running" {
}
if pcg.Status == nil {
return fmt.Errorf("Private Cloud Gateway status not found: %s", PcgId)
}
if pcg.Status.State != "Running" {
return fmt.Errorf("Private Cloud Gateway is not running: %s", PcgId)
} else {
return nil // pcg is running
}
return nil
}

// PCG - vSphere
Expand Down

0 comments on commit 340c078

Please sign in to comment.