Kaynağa Gözat

Merge pull request #23647 from vieux/improve_messages_node_cmds

improve some messages in the node subcmds
Arnaud Porterie 9 yıl önce
ebeveyn
işleme
4c5f1a7e5b

+ 1 - 1
api/client/node/accept.go

@@ -33,7 +33,7 @@ func runAccept(dockerCli *client.DockerCli, flags *pflag.FlagSet, args []string)
 		}); err != nil {
 			return err
 		}
-		fmt.Println(id, "attempting to accept a node in the swarm.")
+		fmt.Fprintf(dockerCli.Out(), "Node %s accepted in the swarm.", id)
 	}
 
 	return nil

+ 1 - 1
api/client/node/demote.go

@@ -33,7 +33,7 @@ func runDemote(dockerCli *client.DockerCli, flags *pflag.FlagSet, args []string)
 		}); err != nil {
 			return err
 		}
-		fmt.Println(id, "attempting to demote a manager in the swarm.")
+		fmt.Fprintf(dockerCli.Out(), "Manager %s demoted in the swarm.", id)
 	}
 
 	return nil

+ 1 - 1
api/client/node/promote.go

@@ -33,7 +33,7 @@ func runPromote(dockerCli *client.DockerCli, flags *pflag.FlagSet, args []string
 		}); err != nil {
 			return err
 		}
-		fmt.Println(id, "attempting to promote a node to a manager in the swarm.")
+		fmt.Fprintf(dockerCli.Out(), "Node %s promoted to a manager in the swarm.", id)
 	}
 
 	return nil

+ 5 - 2
api/client/node/update.go

@@ -21,7 +21,11 @@ func newUpdateCommand(dockerCli *client.DockerCli) *cobra.Command {
 		Short: "Update a node",
 		Args:  cli.ExactArgs(1),
 		RunE: func(cmd *cobra.Command, args []string) error {
-			return runUpdate(dockerCli, args[0], mergeNodeUpdate(flags))
+			if err := runUpdate(dockerCli, args[0], mergeNodeUpdate(flags)); err != nil {
+				return err
+			}
+			fmt.Fprintln(dockerCli.Out(), args[0])
+			return nil
 		},
 	}
 
@@ -47,7 +51,6 @@ func runUpdate(dockerCli *client.DockerCli, nodeID string, mergeNode func(node *
 		return err
 	}
 
-	fmt.Fprintf(dockerCli.Out(), "%s\n", nodeID)
 	return nil
 }