Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release_1.2.49] OCM-13015 | fix: Delete accountroles hcpsharedvpc interactive #2705

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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