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

Fix the "delete namespace" prompt #406

Merged
merged 2 commits into from
Jan 31, 2024
Merged

Conversation

josh-berry
Copy link
Collaborator

@josh-berry josh-berry commented Dec 28, 2023

We were improperly lower-casing the user's input when asking them to confirm the namespace name, and then providing no feedback to the user if the name didn't match, leaving them with the false impression that the namespace was deleted even though we didn't even try.

Closes #405

We were improperly lower-casing the user's input when asking them to
confirm the namespace name, and then providing no feedback to the user
if the name didn't match, leaving them with the false impression that
the namespace was deleted even though we didn't even try.
@josh-berry josh-berry requested a review from a team December 28, 2023 01:24
@josh-berry josh-berry changed the title Fix the "delete namespace" prompt (closes #405) Fix the "delete namespace" prompt Dec 28, 2023
}
fmt.Println()

if len(expectedInputs) == 0 {
return true
}

textLower := strings.ToLower(strings.TrimSpace(text))
for _, expectedInput := range expectedInputs {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as below, I don't really want to make any more changes than absolutely necessary since this is a hotfix.

@@ -303,7 +303,7 @@ func DeleteNamespace(c *cli.Context) error {

promptMsg := color.Red(c, "Are you sure you want to delete namespace %s? Type namespace name to confirm:", ns)
if !common.Prompt(promptMsg, c.Bool(common.FlagYes), ns) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't print the prompt if the user wants to auto-confirm.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We print both the prompt and response, which I think is okay for this hotfix. I don't really want to expand the scope of this PR since we're working on a rewrite.

Copy link
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. We can handle these comments in the rewrite.

@cretz FYI.

@josh-berry josh-berry merged commit 7267df6 into main Jan 31, 2024
17 checks passed
@josh-berry josh-berry deleted the josh/fix-delete-ns-prompt-405 branch January 31, 2024 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Cannot delete namespace that has any upper-case letters
2 participants