Skip to content

Commit

Permalink
Merge pull request #2277 from Mischulee/ocm-7875
Browse files Browse the repository at this point in the history
OCM-7875 | fix: Do not allow creating operator roles with managed policies role arn but no --hosted-cp flag
  • Loading branch information
davidleerh authored Jul 24, 2024
2 parents dea35ab + f9f9d39 commit 2431a23
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/create/operatorroles/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,18 @@ func run(cmd *cobra.Command, argv []string) {
os.Exit(1)
}

if !args.hostedCp && args.installerRoleArn != "" {
managedPolicies, err := r.AWSClient.HasManagedPolicies(args.installerRoleArn)
if err != nil {
r.Reporter.Errorf("Failed to determine if cluster has managed policies: %v", err)
os.Exit(1)
}
if managedPolicies {
r.Reporter.Errorf("The managed policies are not supported for classic operator-roles.")
os.Exit(1)
}
}

var cluster *cmv1.Cluster
if args.prefix == "" {
cluster = r.FetchCluster()
Expand Down

0 comments on commit 2431a23

Please sign in to comment.