From 46930822420ad13f29a06f2bf0e59ea8187c9b10 Mon Sep 17 00:00:00 2001 From: hunterkepley Date: Tue, 10 Dec 2024 15:18:42 -0500 Subject: [PATCH] OCM-13015 | fix: Delete accountroles hcpsharedvpc interactive --- cmd/dlt/accountroles/cmd.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/dlt/accountroles/cmd.go b/cmd/dlt/accountroles/cmd.go index d778b0e90..4ca7fea9b 100644 --- a/cmd/dlt/accountroles/cmd.go +++ b/cmd/dlt/accountroles/cmd.go @@ -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: