mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
judge manager if locked before parsing key
Signed-off-by: allencloud <allen.sun@daocloud.io>
(cherry picked from commit 89100c162b
)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
parent
bdc378e781
commit
2ecc8cd4bd
1 changed files with 5 additions and 5 deletions
|
@ -595,6 +595,11 @@ func (c *Cluster) UnlockSwarm(req types.UnlockRequest) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if c.node != nil || c.locked != true {
|
||||
c.RUnlock()
|
||||
return errors.New("swarm is not locked")
|
||||
}
|
||||
c.RUnlock()
|
||||
|
||||
key, err := encryption.ParseHumanReadableKey(req.UnlockKey)
|
||||
|
@ -603,11 +608,6 @@ func (c *Cluster) UnlockSwarm(req types.UnlockRequest) error {
|
|||
}
|
||||
|
||||
c.Lock()
|
||||
if c.node != nil || c.locked != true {
|
||||
c.Unlock()
|
||||
return errors.New("swarm is not locked")
|
||||
}
|
||||
|
||||
config := *c.lastNodeConfig
|
||||
config.lockKey = key
|
||||
n, err := c.startNewNode(config)
|
||||
|
|
Loading…
Add table
Reference in a new issue