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

cli: improve wildcard namespace prefix matches #10648

Merged
merged 2 commits into from
May 24, 2021
Merged

Conversation

tgross
Copy link
Member

@tgross tgross commented May 24, 2021

Fixes #10625

When a wildcard namespace is used for nomad job commands that support prefix
matching, avoid asking the user for input if a prefix is an unambiguous exact
match so that the behavior is similar to the commands using a specific or
unset namespace.

When a wildcard namespace is used for `nomad job` commands that support prefix
matching, avoid asking the user for input if a prefix is an unambiguous exact
match so that the behavior is similar to the commands using a specific or
unset namespace.
Copy link
Member

@shoenig shoenig left a comment

Choose a reason for hiding this comment

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

LGTM

c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs, c.allNamespaces())))
return 1
if len(jobs) > 1 {
if strings.TrimSpace(jobID) != jobs[0].ID {
Copy link
Member

Choose a reason for hiding this comment

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

nit: couldn't we move the TrimSpace up above, i.e. jobID := strings.TrimSpace(args[0])

Copy link
Member Author

Choose a reason for hiding this comment

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

Alternately, we could remove it and punish anyone who intentionally does nomad job status " example " 😀

Will fix!

@vercel vercel bot temporarily deployed to Preview – nomad May 24, 2021 15:13 Inactive
@tgross tgross added this to the 1.1.1 milestone May 24, 2021
@tgross tgross merged commit 479b4f6 into main May 24, 2021
@tgross tgross deleted the b_job_status_prefix_match branch May 24, 2021 15:38
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot get job status for jobs that are the prefix of another job
2 participants