From 0e1a3f6bbbe2d9295aefad7822989a8162f7d9be Mon Sep 17 00:00:00 2001 From: Lily Guo Date: Wed, 26 Oct 2016 12:46:40 -0700 Subject: [PATCH] Service create --group param --group-add was used for specifying groups for both service create and service update. For create it was confusing since we don't have an existing set of groups. Instead I added --group to create, and moved --group-add to service update only, like --group-rm This deals with issue 27646 Signed-off-by: Lily Guo Update flag documentation Specify that --group, --group-add and --groupd-rm refers to supplementary user groups Signed-off-by: Lily Guo Fix docs for groups and update completion scripts Signed-off-by: Lily Guo --- contrib/completion/bash/docker | 15 ++++++++++----- contrib/completion/zsh/_docker | 6 +++--- docs/reference/commandline/service_create.md | 2 +- docs/reference/commandline/service_update.md | 4 ++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index e1fa2aa5eb..d8365af57d 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -2573,7 +2573,6 @@ _docker_service_update() { --endpoint-mode --env -e --force - --group-add --health-cmd --health-interval --health-retries @@ -2616,6 +2615,7 @@ _docker_service_update() { options_with_args="$options_with_args --container-label --env-file + --group --mode --name " @@ -2629,6 +2629,10 @@ _docker_service_update() { COMPREPLY=( $( compgen -W "global replicated" -- "$cur" ) ) return ;; + --group) + COMPREPLY=( $(compgen -g -- "$cur") ) + return + ;; esac fi if [ "$subcommand" = "update" ] ; then @@ -2636,11 +2640,16 @@ _docker_service_update() { --arg --container-label-add --container-label-rm + --group-add --group-rm --image " case "$prev" in + --group-add) + COMPREPLY=( $(compgen -g -- "$cur") ) + return + ;; --group-rm) COMPREPLY=( $(compgen -g -- "$cur") ) return @@ -2663,10 +2672,6 @@ _docker_service_update() { __docker_nospace return ;; - --group-add) - COMPREPLY=( $(compgen -g -- "$cur") ) - return - ;; --log-driver) __docker_complete_log_drivers return diff --git a/contrib/completion/zsh/_docker b/contrib/completion/zsh/_docker index cb54e8dfc7..a795d1670e 100644 --- a/contrib/completion/zsh/_docker +++ b/contrib/completion/zsh/_docker @@ -1088,7 +1088,6 @@ __docker_service_subcommand() { "($help)*--constraint=[Placement constraints]:constraint: " "($help)--endpoint-mode=[Placement constraints]:mode:(dnsrr vip)" "($help)*"{-e=,--env=}"[Set environment variables]:env: " - "($help)*--group-add=[Add additional user groups to the container]:group:_groups" "($help)--health-cmd=[Command to run to check health]:command: " "($help)--health-interval=[Time between running the check]:time: " "($help)--health-retries=[Consecutive failures needed to report unhealthy]:retries:(1 2 3 4 5)" @@ -1192,7 +1191,8 @@ __docker_service_subcommand() { "($help)*--container-label-add=[Add or update container labels]:label: " \ "($help)*--container-label-rm=[Remove a container label by its key]:label: " \ "($help)--force[Force update]" \ - "($help)*--group-rm=[Remove previously added user groups from the container]:group:_groups" \ + "($help)*--group-add=[Add additional supplementary user groups to the container]:group:_groups" \ + "($help)*--group-rm=[Remove previously added supplementary user groups from the container]:group:_groups" \ "($help)--image=[Service image tag]:image:__docker_repositories" \ "($help)--rollback[Rollback to previous specification]" \ "($help -)1:service:__docker_complete_services" && ret=0 @@ -1465,7 +1465,7 @@ __docker_subcommand() { "($help)--entrypoint=[Overwrite the default entrypoint of the image]:entry point: " "($help)*--env-file=[Read environment variables from a file]:environment file:_files" "($help)*--expose=[Expose a port from the container without publishing it]: " - "($help)*--group-add=[Add additional groups to run as]:group:_groups" + "($help)*--group=[Set one or more supplementary user groups for the container]:group:_groups" "($help -h --hostname)"{-h=,--hostname=}"[Container host name]:hostname:_hosts" "($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]" "($help)--ip=[Container IPv4 address]:IPv4: " diff --git a/docs/reference/commandline/service_create.md b/docs/reference/commandline/service_create.md index 2c023f0c51..3406ad68a0 100644 --- a/docs/reference/commandline/service_create.md +++ b/docs/reference/commandline/service_create.md @@ -26,7 +26,7 @@ Options: --endpoint-mode string Endpoint mode (vip or dnsrr) -e, --env value Set environment variables (default []) --env-file value Read in a file of environment variables (default []) - --group-add value Add additional user groups to the container (default []) + --group value Set one or more supplementary user groups for the container (default []) --health-cmd string Command to run to check health --health-interval duration Time between running the check --health-retries int Consecutive failures needed to report unhealthy diff --git a/docs/reference/commandline/service_update.md b/docs/reference/commandline/service_update.md index 58ffe6e442..cf7dc9bdec 100644 --- a/docs/reference/commandline/service_update.md +++ b/docs/reference/commandline/service_update.md @@ -30,8 +30,8 @@ Options: --env-add value Add or update environment variables (default []) --env-rm value Remove an environment variable (default []) --force Force update even if no changes require it - --group-add value Add additional user groups to the container (default []) - --group-rm value Remove previously added user groups from the container (default []) + --group-add value Add additional supplementary user groups to the container (default []) + --group-rm value Remove previously added supplementary user groups from the container (default []) --health-cmd string Command to run to check health --health-interval duration Time between running the check --health-retries int Consecutive failures needed to report unhealthy