judge manager if locked before parsing key
Signed-off-by: allencloud <allen.sun@daocloud.io> Upstream-commit: 89100c162b23791b4a64d142a11014257bf61fd0 Component: engine
This commit is contained in:
@@ -592,6 +592,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)
|
||||
@@ -600,11 +605,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)
|
||||
|
||||
Reference in New Issue
Block a user