judge manager if locked before parsing key
Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
parent
103f2e56bf
commit
89100c162b
|
@ -592,6 +592,11 @@ func (c *Cluster) UnlockSwarm(req types.UnlockRequest) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c.node != nil || c.locked != true {
|
||||||
|
c.RUnlock()
|
||||||
|
return errors.New("swarm is not locked")
|
||||||
|
}
|
||||||
c.RUnlock()
|
c.RUnlock()
|
||||||
|
|
||||||
key, err := encryption.ParseHumanReadableKey(req.UnlockKey)
|
key, err := encryption.ParseHumanReadableKey(req.UnlockKey)
|
||||||
|
@ -600,11 +605,6 @@ func (c *Cluster) UnlockSwarm(req types.UnlockRequest) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Lock()
|
c.Lock()
|
||||||
if c.node != nil || c.locked != true {
|
|
||||||
c.Unlock()
|
|
||||||
return errors.New("swarm is not locked")
|
|
||||||
}
|
|
||||||
|
|
||||||
config := *c.lastNodeConfig
|
config := *c.lastNodeConfig
|
||||||
config.lockKey = key
|
config.lockKey = key
|
||||||
n, err := c.startNewNode(config)
|
n, err := c.startNewNode(config)
|
||||||
|
|
Loading…
Reference in New Issue