mirror of https://github.com/docker/cli.git
change join node role judge
Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
parent
06ebd4517d
commit
f2a6d37388
|
@ -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 {
|
|
||||||
// TODO(aaronl): is there a better way to do this?
|
|
||||||
if strings.Contains(err.Error(), "This node is not a swarm manager.") {
|
|
||||||
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.")
|
fmt.Fprintln(dockerCli.Out(), "This node joined a swarm as a manager.")
|
||||||
|
} else {
|
||||||
|
fmt.Fprintln(dockerCli.Out(), "This node joined a swarm as a worker.")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue