mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
judge manager before unlocking
Signed-off-by: allencloud <allen.sun@daocloud.io>
(cherry picked from commit 972a246c67
)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
parent
10ce88227d
commit
cd587419d0
1 changed files with 9 additions and 0 deletions
|
@ -587,6 +587,15 @@ func (c *Cluster) GetUnlockKey() (string, error) {
|
|||
|
||||
// UnlockSwarm provides a key to decrypt data that is encrypted at rest.
|
||||
func (c *Cluster) UnlockSwarm(req types.UnlockRequest) error {
|
||||
c.RLock()
|
||||
if !c.isActiveManager() {
|
||||
if err := c.errNoManager(); err != ErrSwarmLocked {
|
||||
c.RUnlock()
|
||||
return err
|
||||
}
|
||||
}
|
||||
c.RUnlock()
|
||||
|
||||
key, err := encryption.ParseHumanReadableKey(req.UnlockKey)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue