Browse code

Remove --command flag for service update

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Vincent Demeester authored on 2016/07/13 23:19:21
Showing 7 changed files
... ...
@@ -153,9 +153,6 @@ func printService(out io.Writer, service swarm.Service) {
153 153
 
154 154
 func printContainerSpec(out io.Writer, containerSpec swarm.ContainerSpec) {
155 155
 	fmt.Fprintf(out, " Image:\t\t%s\n", containerSpec.Image)
156
-	if len(containerSpec.Command) > 0 {
157
-		fmt.Fprintf(out, " Command:\t%s\n", strings.Join(containerSpec.Command, " "))
158
-	}
159 156
 	if len(containerSpec.Args) > 0 {
160 157
 		fmt.Fprintf(out, " Args:\t\t%s\n", strings.Join(containerSpec.Args, " "))
161 158
 	}
... ...
@@ -373,7 +373,6 @@ type serviceOptions struct {
373 373
 	name    string
374 374
 	labels  opts.ListOpts
375 375
 	image   string
376
-	command []string
377 376
 	args    []string
378 377
 	env     opts.ListOpts
379 378
 	workdir string
... ...
@@ -416,7 +415,6 @@ func (opts *serviceOptions) ToService() (swarm.ServiceSpec, error) {
416 416
 		TaskTemplate: swarm.TaskSpec{
417 417
 			ContainerSpec: swarm.ContainerSpec{
418 418
 				Image:           opts.image,
419
-				Command:         opts.command,
420 419
 				Args:            opts.args,
421 420
 				Env:             opts.env.GetAll(),
422 421
 				Dir:             opts.workdir,
... ...
@@ -31,7 +31,6 @@ func newUpdateCommand(dockerCli *client.DockerCli) *cobra.Command {
31 31
 
32 32
 	flags := cmd.Flags()
33 33
 	flags.String("image", "", "Service image tag")
34
-	flags.StringSlice("command", []string{}, "Service command")
35 34
 	flags.StringSlice("arg", []string{}, "Service command args")
36 35
 	addServiceFlags(cmd, opts)
37 36
 	return cmd
... ...
@@ -141,7 +140,6 @@ func updateService(flags *pflag.FlagSet, spec *swarm.ServiceSpec) error {
141 141
 	updateString(flagName, &spec.Name)
142 142
 	updateLabels(flags, &spec.Labels)
143 143
 	updateString("image", &cspec.Image)
144
-	updateSlice("command", &cspec.Command)
145 144
 	updateSlice("arg", &cspec.Args)
146 145
 	updateListOpts("env", &cspec.Env)
147 146
 	updateString("workdir", &cspec.Dir)
... ...
@@ -7,20 +7,15 @@ import (
7 7
 	"github.com/docker/engine-api/types/swarm"
8 8
 )
9 9
 
10
-func TestUpdateServiceCommandAndArgs(t *testing.T) {
10
+func TestUpdateServiceArgs(t *testing.T) {
11 11
 	flags := newUpdateCommand(nil).Flags()
12
-	flags.Set("command", "the")
13
-	flags.Set("command", "new")
14
-	flags.Set("command", "command")
15 12
 	flags.Set("arg", "the")
16 13
 	flags.Set("arg", "new args")
17 14
 
18 15
 	spec := &swarm.ServiceSpec{}
19 16
 	cspec := &spec.TaskTemplate.ContainerSpec
20
-	cspec.Command = []string{"old", "command"}
21 17
 	cspec.Args = []string{"old", "args"}
22 18
 
23 19
 	updateService(flags, spec)
24
-	assert.EqualStringSlice(t, cspec.Command, []string{"the", "new", "command"})
25 20
 	assert.EqualStringSlice(t, cspec.Args, []string{"the", "new args"})
26 21
 }
... ...
@@ -1736,7 +1736,6 @@ _docker_service_update() {
1736 1736
 	if [ "$subcommand" = "update" ] ; then
1737 1737
 		options_with_args="$options_with_args
1738 1738
 			--arg
1739
-			--command
1740 1739
 			--image
1741 1740
 		"
1742 1741
 
... ...
@@ -1154,7 +1154,6 @@ __docker_service_subcommand() {
1154 1154
                 $opts_help \
1155 1155
                 $opts_create_update \
1156 1156
                 "($help)--arg=[Service command args]:arguments: _normal" \
1157
-                "($help)--command=[Service command]:command: _command_names -e" \
1158 1157
                 "($help)--image=[Service image tag]:image:__docker_repositories" \
1159 1158
                 "($help -)1:service:__docker_complete_services" && ret=0
1160 1159
             ;;
... ...
@@ -18,7 +18,6 @@ Update a service
18 18
 
19 19
 Options:
20 20
       --arg value                    Service command args (default [])
21
-      --command value                Service command (default [])
22 21
       --constraint value             Placement constraints (default [])
23 22
       --endpoint-mode string         Endpoint mode (vip or dnsrr)
24 23
   -e, --env value                    Set environment variables (default [])