mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
api/v2auth: remove defer in loop.
This commit is contained in:
parent
8945fecf85
commit
e96dbfb973
@ -32,7 +32,6 @@ func (s *store) ensureAuthDirectories() error {
|
||||
}
|
||||
for _, res := range []string{StorePermsPrefix, StorePermsPrefix + "/users/", StorePermsPrefix + "/roles/"} {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), s.timeout)
|
||||
defer cancel()
|
||||
pe := false
|
||||
rr := etcdserverpb.Request{
|
||||
Method: "PUT",
|
||||
@ -41,6 +40,7 @@ func (s *store) ensureAuthDirectories() error {
|
||||
PrevExist: &pe,
|
||||
}
|
||||
_, err := s.server.Do(ctx, rr)
|
||||
cancel()
|
||||
if err != nil {
|
||||
if e, ok := err.(*v2error.Error); ok {
|
||||
if e.ErrorCode == v2error.EcodeNodeExist {
|
||||
|
Loading…
x
Reference in New Issue
Block a user