mirror of
https://github.com/status-im/consul.git
synced 2025-02-02 00:46:43 +00:00
Merge pull request #13787 from hashicorp/fix-acl-read-token-self-expanded-panic
Fix panic on acl token read with -self and -expanded
This commit is contained in:
commit
067272b53f
3
.changelog/13787.txt
Normal file
3
.changelog/13787.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
```release-note:bug
|
||||||
|
cli: when `acl token read` is used with the `-self` and `-expanded` flags, return an error instead of panicking
|
||||||
|
```
|
@ -92,6 +92,13 @@ func (c *cmd) Run(args []string) int {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// TODO: consider updating this CLI command and underlying HTTP API endpoint
|
||||||
|
// to support expanded read of a "self" token, which is a much better user workflow.
|
||||||
|
if c.expanded {
|
||||||
|
c.UI.Error("Cannot use both -expanded and -self. Instead, use -expanded and -id=<accessor id>.")
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
t, _, err = client.ACL().TokenReadSelf(nil)
|
t, _, err = client.ACL().TokenReadSelf(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.UI.Error(fmt.Sprintf("Error reading token: %v", err))
|
c.UI.Error(fmt.Sprintf("Error reading token: %v", err))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user