-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat: allow role updates to token using cli #23479
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @burnerlee, this looks great, thanks a lot for contributing! I left some comments, but nothing major.
Would you also add a changelog message? Something like:
release-note:improvement
cli: Allow role updates to token
(you can use make cl
command to generate it)
@@ -70,6 +79,14 @@ func (c *ACLTokenUpdateCommand) Run(args []string) int { | |||
policies = append(policies, s) | |||
return nil | |||
}), "policy", "") | |||
flags.Var((funcVar)(func(s string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great to have these in AutocompleteFlags()
method, too (with complete.PredictAnything
)
@@ -111,6 +128,11 @@ func (c *ACLTokenUpdateCommand) Run(args []string) int { | |||
token.Policies = policies | |||
} | |||
|
|||
roles := generateACLTokenRoleLinks(c.roleNames, c.roleIDs) | |||
if len(roles) != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we should also check whether there are any roleIDs
set? perhaps len(roles) != 0 || len(ids) != 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also perhaps move the check before calling generateACLTokenRoleLinks
?
ah one more thing: could you update the documentation to include these new flags, too? https://github.com/hashicorp/nomad/blob/main/website/content/docs/commands/acl/token/update.mdx |
Sorry, it looks like we had a PR in-flight for this which got abandoned, and I didn't notice that we had this open when I carried that PR. I'm going to close this in lieu of #18532. My apologies @burnerlee! |
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. |
This PR adds the following flag functionality to
nomad acl token update
to allow users to update token roles:-role-id
role-name
Fixes: #18354