|
@@ -2,6 +2,7 @@ package node
|
|
|
|
|
|
import (
|
|
import (
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "strings"
|
|
|
|
|
|
"golang.org/x/net/context"
|
|
"golang.org/x/net/context"
|
|
|
|
|
|
@@ -35,12 +36,21 @@ func newRemoveCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|
func runRemove(dockerCli *command.DockerCli, args []string, opts removeOptions) error {
|
|
func runRemove(dockerCli *command.DockerCli, args []string, opts removeOptions) error {
|
|
client := dockerCli.Client()
|
|
client := dockerCli.Client()
|
|
ctx := context.Background()
|
|
ctx := context.Background()
|
|
|
|
+
|
|
|
|
+ var errs []string
|
|
|
|
+
|
|
for _, nodeID := range args {
|
|
for _, nodeID := range args {
|
|
err := client.NodeRemove(ctx, nodeID, types.NodeRemoveOptions{Force: opts.force})
|
|
err := client.NodeRemove(ctx, nodeID, types.NodeRemoveOptions{Force: opts.force})
|
|
if err != nil {
|
|
if err != nil {
|
|
- return err
|
|
|
|
|
|
+ errs = append(errs, err.Error())
|
|
|
|
+ continue
|
|
}
|
|
}
|
|
fmt.Fprintf(dockerCli.Out(), "%s\n", nodeID)
|
|
fmt.Fprintf(dockerCli.Out(), "%s\n", nodeID)
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if len(errs) > 0 {
|
|
|
|
+ return fmt.Errorf("%s", strings.Join(errs, "\n"))
|
|
|
|
+ }
|
|
|
|
+
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|