mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
return error when listNode fails
Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
parent
7d0041f9e5
commit
8e04e9902a
2 changed files with 4 additions and 2 deletions
|
@ -103,7 +103,7 @@ func prettyPrintInfo(dockerCli *command.DockerCli, info types.Info) error {
|
|||
fmt.Fprintf(dockerCli.Out(), " Error: %v\n", info.Swarm.Error)
|
||||
}
|
||||
fmt.Fprintf(dockerCli.Out(), " Is Manager: %v\n", info.Swarm.ControlAvailable)
|
||||
if info.Swarm.ControlAvailable {
|
||||
if info.Swarm.ControlAvailable && info.Swarm.Error == "" && info.Swarm.LocalNodeState != swarm.LocalNodeStateError {
|
||||
fmt.Fprintf(dockerCli.Out(), " ClusterID: %s\n", info.Swarm.Cluster.ID)
|
||||
fmt.Fprintf(dockerCli.Out(), " Managers: %d\n", info.Swarm.Managers)
|
||||
fmt.Fprintf(dockerCli.Out(), " Nodes: %d\n", info.Swarm.Nodes)
|
||||
|
|
|
@ -750,7 +750,9 @@ func (c *Cluster) Info() types.Info {
|
|||
// Strip JoinTokens
|
||||
info.Cluster = swarm.ClusterInfo
|
||||
|
||||
if r, err := state.controlClient.ListNodes(ctx, &swarmapi.ListNodesRequest{}); err == nil {
|
||||
if r, err := state.controlClient.ListNodes(ctx, &swarmapi.ListNodesRequest{}); err != nil {
|
||||
info.Error = err.Error()
|
||||
} else {
|
||||
info.Nodes = len(r.Nodes)
|
||||
for _, n := range r.Nodes {
|
||||
if n.ManagerStatus != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue