Merge pull request #27530 from allencloud/change-join-role-display-judge

change join node role judge
This commit is contained in:
Tõnis Tiigi 2016-10-20 17:46:08 -07:00 committed by GitHub
commit 9ef3b7e6ff
1 changed files with 3 additions and 9 deletions

View File

@ -2,7 +2,6 @@ package swarm
import ( import (
"fmt" "fmt"
"strings"
"github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/cli" "github.com/docker/docker/cli"
@ -61,15 +60,10 @@ func runJoin(dockerCli *command.DockerCli, opts joinOptions) error {
return err return err
} }
_, _, err = client.NodeInspectWithRaw(ctx, info.Swarm.NodeID) if info.Swarm.ControlAvailable {
if err != nil { fmt.Fprintln(dockerCli.Out(), "This node joined a swarm as a manager.")
// TODO(aaronl): is there a better way to do this? } else {
if strings.Contains(err.Error(), "This node is not a swarm manager.") {
fmt.Fprintln(dockerCli.Out(), "This node joined a swarm as a worker.") fmt.Fprintln(dockerCli.Out(), "This node joined a swarm as a worker.")
} }
} else {
fmt.Fprintln(dockerCli.Out(), "This node joined a swarm as a manager.")
}
return nil return nil
} }