mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
cli: show warning when creating token if policy doesn't exist (#16437)
This commit is contained in:
3
.changelog/16437.txt
Normal file
3
.changelog/16437.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:improvement
|
||||
cli: `acl token create` will now emit a warning if the token has a policy that does not yet exist
|
||||
```
|
||||
@@ -154,6 +154,14 @@ func (c *ACLTokenCreateCommand) Run(args []string) int {
|
||||
return 1
|
||||
}
|
||||
|
||||
// Show warning if policy doesn't exist
|
||||
for _, policy := range tk.Policies {
|
||||
_, _, err := client.ACLPolicies().Info(policy, nil)
|
||||
if err != nil {
|
||||
c.Ui.Warn(fmt.Sprintf("Error fetching info on %s policy: %s", policy, err))
|
||||
}
|
||||
}
|
||||
|
||||
// Create the bootstrap token
|
||||
token, _, err := client.ACLTokens().Create(tk, nil)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user