Skip to content

Commit

Permalink
OCM-1109 | fix: Check if op roles exist always again
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterkepley authored and ciaranRoche committed Feb 19, 2024
1 parent 82eed84 commit 0dc147d
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions cmd/create/operatorroles/by_clusterkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ func handleOperatorRoleCreationByClusterKey(r *rosa.Runtime, env string,
os.Exit(1)
}

// Check to see if IAM operator roles have already created
missingRoles, err := validateOperatorRoles(r, cluster)
if err != nil {
if strings.Contains(err.Error(), "AccessDenied") {
r.Reporter.Debugf("Failed to verify if operator roles exist: '%v'", err)
} else {
r.Reporter.Errorf("Failed to verify if operator roles exist: '%v'", err)
os.Exit(1)
}
}

hostedCPPolicies := aws.IsHostedCPManagedPolicies(cluster)

operatorRolePolicyPrefix, err := aws.GetOperatorRolePolicyPrefixFromCluster(cluster, r.AWSClient)
Expand All @@ -49,16 +60,6 @@ func handleOperatorRoleCreationByClusterKey(r *rosa.Runtime, env string,

switch mode {
case aws.ModeAuto:
// Check to see if IAM operator roles have already created
missingRoles, err := validateOperatorRoles(r, cluster)
if err != nil {
if strings.Contains(err.Error(), "AccessDenied") {
r.Reporter.Debugf("Failed to verify if operator roles exist: '%v'", err)
} else {
r.Reporter.Errorf("Failed to verify if operator roles exist: '%v'", err)
os.Exit(1)
}
}

if len(missingRoles) == 0 {
if ocm.IsOidcConfigReusable(cluster) {
Expand Down

0 comments on commit 0dc147d

Please sign in to comment.