Skip to content

Commit

Permalink
Merge pull request #2705 from openshift-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…2701-to-release_1.2.49

[release_1.2.49] OCM-13015 | fix: Delete accountroles hcpsharedvpc interactive
  • Loading branch information
hunterkepley authored Dec 10, 2024
2 parents 99fffdf + 4693082 commit 0bbbd7b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions cmd/dlt/accountroles/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,21 +224,21 @@ func deleteAccountRoles(r *rosa.Runtime, cmd *cobra.Command, env string, prefix
r.OCMClient.LogEvent("ROSADeleteAccountRoleModeAuto", nil)
if roles.CheckIfRolesAreHcpSharedVpc(r, finalRoleList) &&
!cmd.Flag(deleteHcpSharedVpcPoliciesFlagName).Changed {
deleteHcpSharedVpcPolicies = confirm.Prompt(true, "Attempt to delete Hosted CP shared VPC policies?")
deleteHcpSharedVpcPolicies = confirm.Prompt(args.deleteHcpSharedVpcPolicies,
"Attempt to delete Hosted CP shared VPC policies?")
}

if deleteHcpSharedVpcPolicies {
for _, role := range finalRoleList {
if !confirm.Prompt(true, "Delete the account role '%s'?", role) {
continue
}
r.Reporter.Infof("Deleting account role '%s'", role)
err := r.AWSClient.DeleteAccountRole(role, prefix, managedPolicies, deleteHcpSharedVpcPolicies)
if err != nil {
r.Reporter.Warnf("There was an error deleting the account roles or policies: %s", err)
continue
}
for _, role := range finalRoleList {
if !confirm.Prompt(true, "Delete the account role '%s'?", role) {
continue
}
r.Reporter.Infof("Deleting account role '%s'", role)
err := r.AWSClient.DeleteAccountRole(role, prefix, managedPolicies, deleteHcpSharedVpcPolicies)
if err != nil {
r.Reporter.Warnf("There was an error deleting the account roles or policies: %s", err)
continue
}

r.Reporter.Infof(fmt.Sprintf("Successfully deleted the %s account roles", roleTypeString))
}
case interactive.ModeManual:
Expand Down

0 comments on commit 0bbbd7b

Please sign in to comment.