judge manager before getting secret

Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
allencloud 2016-11-13 12:39:02 +08:00
parent c8492ebc5d
commit 1addb4817b
2 changed files with 10 additions and 2 deletions

View File

@ -9,6 +9,13 @@ import (
// GetSecret returns a secret from a managed swarm cluster
func (c *Cluster) GetSecret(id string) (types.Secret, error) {
c.RLock()
defer c.RUnlock()
if !c.isActiveManager() {
return types.Secret{}, c.errNoManager()
}
ctx, cancel := c.getRequestContext()
defer cancel()

View File

@ -6060,9 +6060,9 @@ Create a secret
### Inspect a secret
`GET /secrets/(secret id)`
`GET /secrets/(id)`
Get details on a secret
Get details on the secret `id`
**Example request**:
@ -6088,6 +6088,7 @@ Get details on a secret
- **200** no error
- **404** unknown secret
- **406** node is not part of a swarm
- **500** server error
### Remove a secret