Browse code

improve some messages in the node subcmds

Signed-off-by: Victor Vieux <vieux@docker.com>
(cherry picked from commit eb962235fbf1579cf36bb0582347e8639ec47205)

Victor Vieux authored on 2016/06/17 08:39:27
Showing 4 changed files
... ...
@@ -33,7 +33,7 @@ func runAccept(dockerCli *client.DockerCli, flags *pflag.FlagSet, args []string)
33 33
 		}); err != nil {
34 34
 			return err
35 35
 		}
36
-		fmt.Println(id, "attempting to accept a node in the swarm.")
36
+		fmt.Fprintf(dockerCli.Out(), "Node %s accepted in the swarm.", id)
37 37
 	}
38 38
 
39 39
 	return nil
... ...
@@ -33,7 +33,7 @@ func runDemote(dockerCli *client.DockerCli, flags *pflag.FlagSet, args []string)
33 33
 		}); err != nil {
34 34
 			return err
35 35
 		}
36
-		fmt.Println(id, "attempting to demote a manager in the swarm.")
36
+		fmt.Fprintf(dockerCli.Out(), "Manager %s demoted in the swarm.", id)
37 37
 	}
38 38
 
39 39
 	return nil
... ...
@@ -33,7 +33,7 @@ func runPromote(dockerCli *client.DockerCli, flags *pflag.FlagSet, args []string
33 33
 		}); err != nil {
34 34
 			return err
35 35
 		}
36
-		fmt.Println(id, "attempting to promote a node to a manager in the swarm.")
36
+		fmt.Fprintf(dockerCli.Out(), "Node %s promoted to a manager in the swarm.", id)
37 37
 	}
38 38
 
39 39
 	return nil
... ...
@@ -21,7 +21,11 @@ func newUpdateCommand(dockerCli *client.DockerCli) *cobra.Command {
21 21
 		Short: "Update a node",
22 22
 		Args:  cli.ExactArgs(1),
23 23
 		RunE: func(cmd *cobra.Command, args []string) error {
24
-			return runUpdate(dockerCli, args[0], mergeNodeUpdate(flags))
24
+			if err := runUpdate(dockerCli, args[0], mergeNodeUpdate(flags)); err != nil {
25
+				return err
26
+			}
27
+			fmt.Fprintln(dockerCli.Out(), args[0])
28
+			return nil
25 29
 		},
26 30
 	}
27 31
 
... ...
@@ -47,7 +51,6 @@ func runUpdate(dockerCli *client.DockerCli, nodeID string, mergeNode func(node *
47 47
 		return err
48 48
 	}
49 49
 
50
-	fmt.Fprintf(dockerCli.Out(), "%s\n", nodeID)
51 50
 	return nil
52 51
 }
53 52