Skip to content

Commit

Permalink
OCM-7875 | fix: Do not allow managed policies role without hcp flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Mischulee committed Jul 23, 2024
1 parent b1987b1 commit f9f9d39
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 f9f9d39

Please sign in to comment.