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>
This commit is contained in:
parent
8874f80e67
commit
972a246c67
1 changed files with 9 additions and 0 deletions
|
@ -585,6 +585,15 @@ func (c *Cluster) GetUnlockKey() (string, error) {
|
||||||
|
|
||||||
// UnlockSwarm provides a key to decrypt data that is encrypted at rest.
|
// UnlockSwarm provides a key to decrypt data that is encrypted at rest.
|
||||||
func (c *Cluster) UnlockSwarm(req types.UnlockRequest) error {
|
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)
|
key, err := encryption.ParseHumanReadableKey(req.UnlockKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Add table
Reference in a new issue