Skip to content

Commit 2e32d20

Browse files
authored
Merge pull request #3006 from hunterkepley/ocm-18327
OCM-18327 | fix: Prompt user for what input method they want
2 parents 1ec4a99 + ec0065b commit 2e32d20

File tree

1 file changed

+13
-1
lines changed
  • cmd/dlt/iamserviceaccount

1 file changed

+13
-1
lines changed

cmd/dlt/iamserviceaccount/cmd.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,19 @@ func DeleteIamServiceAccountRunner(userOptions *iamServiceAccountOpts.DeleteIamS
7373
serviceAccountName := userOptions.ServiceAccountName
7474
namespace := userOptions.Namespace
7575

76-
if roleName == "" {
76+
useExplicitRoleName, err := interactive.GetBool(interactive.Input{
77+
Question: "Do you want to provide an explicit role name",
78+
Help: "Whether or not to delete based on an explicit role name. If you choose 'No' to this prompt," +
79+
" you will be prompted for a service account name and namespace to generate the iam service account " +
80+
"role name to delete.",
81+
Required: true,
82+
Default: true,
83+
})
84+
if err != nil {
85+
return fmt.Errorf("expected a valid response to yes/no prompt: %s", err)
86+
}
87+
88+
if !useExplicitRoleName {
7789
// Need service account details to derive role name
7890
if interactive.Enabled() && serviceAccountName == "" {
7991
serviceAccountName, err = interactive.GetString(interactive.Input{

0 commit comments

Comments
 (0)