mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #6946 from heyitsanthony/fix-e2e-getrole
etcdctl: remove GetUser check before mutable commands
This commit is contained in:
commit
b9b14b15d6
@ -112,11 +112,6 @@ func actionUserAdd(c *cli.Context) error {
|
|||||||
ctx, cancel := contextWithTotalTimeout(c)
|
ctx, cancel := contextWithTotalTimeout(c)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
user, _, _ := getUsernamePassword("", userarg+":")
|
user, _, _ := getUsernamePassword("", userarg+":")
|
||||||
currentUser, err := api.GetUser(ctx, user)
|
|
||||||
if currentUser != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, "User %s already exists\n", user)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
_, pass, err := getUsernamePassword("New password: ", userarg)
|
_, pass, err := getUsernamePassword("New password: ", userarg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -151,11 +146,6 @@ func actionUserPasswd(c *cli.Context) error {
|
|||||||
api, user := mustUserAPIAndName(c)
|
api, user := mustUserAPIAndName(c)
|
||||||
ctx, cancel := contextWithTotalTimeout(c)
|
ctx, cancel := contextWithTotalTimeout(c)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
currentUser, err := api.GetUser(ctx, user)
|
|
||||||
if currentUser == nil {
|
|
||||||
fmt.Fprintln(os.Stderr, err.Error())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
pass, err := speakeasy.Ask("New password: ")
|
pass, err := speakeasy.Ask("New password: ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "Error reading password:", err)
|
fmt.Fprintln(os.Stderr, "Error reading password:", err)
|
||||||
@ -193,12 +183,7 @@ func userGrantRevoke(c *cli.Context, grant bool) {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
api, user := mustUserAPIAndName(c)
|
api, user := mustUserAPIAndName(c)
|
||||||
currentUser, err := api.GetUser(ctx, user)
|
var err error
|
||||||
if currentUser == nil {
|
|
||||||
fmt.Fprintln(os.Stderr, err.Error())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
if grant {
|
if grant {
|
||||||
_, err = api.GrantUser(ctx, user, roles)
|
_, err = api.GrantUser(ctx, user, roles)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user