1
0
mirror of https://github.com/docker/cli.git synced 2026-01-26 15:41:42 +03:00

Merge pull request #28533 from allencloud/judge-manager-first-before-unlocking

judge manager before unlocking
Upstream-commit: eb0fc787e699b20d884c8d0dc23a5392e5aeb1a8
Component: engine
This commit is contained in:
Tõnis Tiigi
2016-11-18 11:27:48 -08:00
committed by GitHub

View File

@@ -585,6 +585,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