Skip to content

Commit

Permalink
Merge pull request #55 from mcornea/cluster_id_function
Browse files Browse the repository at this point in the history
Add GetClusterId function to cluster package
  • Loading branch information
mcornea authored Jan 26, 2024
2 parents b86fdd3 + c6531af commit 85eee7e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/internal/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,18 @@ func GetClusterVersion(apiClient *clients.Settings) (string, error) {

return clusterVersion.Object.Status.Desired.Version, nil
}

// GetClusterID can be used to get the Openshift version from the provided cluster.
func GetClusterID(apiClient *clients.Settings) (string, error) {
// Check if the client was even defined first
if apiClient == nil {
return "", fmt.Errorf("provided client was not defined")
}

clusterVersion, err := clusterversion.Pull(apiClient)
if err != nil {
return "", err
}

return string(clusterVersion.Object.Spec.ClusterID), nil
}

0 comments on commit 85eee7e

Please sign in to comment.