Browse code

Merge pull request #26988 from thaJeztah/remove-service-update-name-flag

Remove service update name flag

Sebastiaan van Stijn authored on 2016/10/28 08:55:47
Showing 8 changed files
... ...
@@ -27,6 +27,8 @@ func newCreateCommand(dockerCli *command.DockerCli) *cobra.Command {
27 27
 	}
28 28
 	flags := cmd.Flags()
29 29
 	flags.StringVar(&opts.mode, flagMode, "replicated", "Service mode (replicated or global)")
30
+	flags.StringVar(&opts.name, flagName, "", "Service name")
31
+
30 32
 	addServiceFlags(cmd, opts)
31 33
 
32 34
 	flags.VarP(&opts.labels, flagLabel, "l", "Service labels")
... ...
@@ -511,7 +511,6 @@ func (opts *serviceOptions) ToService() (swarm.ServiceSpec, error) {
511 511
 // Any flags that are not common are added separately in the individual command
512 512
 func addServiceFlags(cmd *cobra.Command, opts *serviceOptions) {
513 513
 	flags := cmd.Flags()
514
-	flags.StringVar(&opts.name, flagName, "", "Service name")
515 514
 
516 515
 	flags.StringVarP(&opts.workdir, flagWorkdir, "w", "", "Working directory inside the container")
517 516
 	flags.StringVarP(&opts.user, flagUser, "u", "", "Username or UID (format: <name|uid>[:<group|gid>])")
... ...
@@ -172,7 +172,6 @@ func updateService(flags *pflag.FlagSet, spec *swarm.ServiceSpec) error {
172 172
 		return task.Resources
173 173
 	}
174 174
 
175
-	updateString(flagName, &spec.Name)
176 175
 	updateLabels(flags, &spec.Labels)
177 176
 	updateContainerLabels(flags, &cspec.Labels)
178 177
 	updateString("image", &cspec.Image)
... ...
@@ -2576,7 +2576,6 @@ _docker_service_update() {
2576 2576
 		--log-driver
2577 2577
 		--log-opt
2578 2578
 		--mount
2579
-		--name
2580 2579
 		--network
2581 2580
 		--publish -p
2582 2581
 		--replicas
... ...
@@ -2608,6 +2607,7 @@ _docker_service_update() {
2608 2608
 		options_with_args="$options_with_args
2609 2609
 			--container-label
2610 2610
 			--mode
2611
+			--name
2611 2612
 		"
2612 2613
 
2613 2614
 		case "$prev" in
... ...
@@ -1095,7 +1095,6 @@ __docker_service_subcommand() {
1095 1095
         "($help)--log-driver=[Logging driver for service]:logging driver:__docker_log_drivers"
1096 1096
         "($help)*--log-opt=[Logging driver options]:log driver options:__docker_log_options"
1097 1097
         "($help)*--mount=[Attach a mount to the service]:mount: "
1098
-        "($help)--name=[Service name]:name: "
1099 1098
         "($help)*--network=[Network attachments]:network: "
1100 1099
         "($help)*"{-p=,--publish=}"[Publish a port as a node port]:port: "
1101 1100
         "($help)--replicas=[Number of tasks]:replicas: "
... ...
@@ -1123,6 +1122,7 @@ __docker_service_subcommand() {
1123 1123
                 $opts_create_update \
1124 1124
                 "($help)*--container-label=[Container labels]:label: " \
1125 1125
                 "($help)--mode=[Service Mode]:mode:(global replicated)" \
1126
+                "($help)--name=[Service name]:name: " \
1126 1127
                 "($help -): :__docker_images" \
1127 1128
                 "($help -):command: _command_names -e" \
1128 1129
                 "($help -)*::arguments: _normal" && ret=0
... ...
@@ -4846,7 +4846,7 @@ image](#create-an-image) section for more details.
4846 4846
 
4847 4847
 **JSON Parameters**:
4848 4848
 
4849
-- **Name** – User-defined name for the service.
4849
+- **Name** – User-defined name for the service. Note that renaming services is not supported.
4850 4850
 - **Labels** – A map of labels to associate with the service (e.g., `{"key":"value", "key2":"value2"}`).
4851 4851
 - **TaskTemplate** – Specification of the tasks to start as part of the new service.
4852 4852
     - **ContainerSpec** - Container settings for containers started as part of this task.
... ...
@@ -5375,7 +5375,7 @@ image](#create-an-image) section for more details.
5375 5375
 
5376 5376
 **JSON Parameters**:
5377 5377
 
5378
-- **Name** – User-defined name for the service.
5378
+- **Name** – User-defined name for the service. Note that renaming services is not supported.
5379 5379
 - **Labels** – A map of labels to associate with the service (e.g., `{"key":"value", "key2":"value2"}`).
5380 5380
 - **TaskTemplate** – Specification of the tasks to start as part of the new service.
5381 5381
     - **ContainerSpec** - Container settings for containers started as part of this task.
... ...
@@ -42,7 +42,6 @@ Options:
42 42
       --log-opt value                    Logging driver options (default [])
43 43
       --mount-add value                  Add or update a mount on a service
44 44
       --mount-rm value                   Remove a mount by its target path (default [])
45
-      --name string                      Service name
46 45
       --publish-add value                Add or update a published port (default [])
47 46
       --publish-rm value                 Remove a published port by its target port (default [])
48 47
       --replicas value                   Number of tasks (default none)