Merge pull request #24525 from vdemeester/24196-remove-command-flag-on-service-update

Remove --command flag for service update
This commit is contained in:
Arnaud Porterie 2016-07-13 16:01:11 +00:00 коммит произвёл GitHub
Родитель ee981bcc73 e4a024d590
Коммит 58624acf11
7 изменённых файлов: 1 добавлений и 16 удалений

Просмотреть файл

@ -153,9 +153,6 @@ func printService(out io.Writer, service swarm.Service) {
func printContainerSpec(out io.Writer, containerSpec swarm.ContainerSpec) {
fmt.Fprintf(out, " Image:\t\t%s\n", containerSpec.Image)
if len(containerSpec.Command) > 0 {
fmt.Fprintf(out, " Command:\t%s\n", strings.Join(containerSpec.Command, " "))
}
if len(containerSpec.Args) > 0 {
fmt.Fprintf(out, " Args:\t\t%s\n", strings.Join(containerSpec.Args, " "))
}

Просмотреть файл

@ -373,7 +373,6 @@ type serviceOptions struct {
name string
labels opts.ListOpts
image string
command []string
args []string
env opts.ListOpts
workdir string
@ -416,7 +415,6 @@ func (opts *serviceOptions) ToService() (swarm.ServiceSpec, error) {
TaskTemplate: swarm.TaskSpec{
ContainerSpec: swarm.ContainerSpec{
Image: opts.image,
Command: opts.command,
Args: opts.args,
Env: opts.env.GetAll(),
Dir: opts.workdir,

Просмотреть файл

@ -31,7 +31,6 @@ func newUpdateCommand(dockerCli *client.DockerCli) *cobra.Command {
flags := cmd.Flags()
flags.String("image", "", "Service image tag")
flags.StringSlice("command", []string{}, "Service command")
flags.StringSlice("arg", []string{}, "Service command args")
addServiceFlags(cmd, opts)
return cmd
@ -141,7 +140,6 @@ func updateService(flags *pflag.FlagSet, spec *swarm.ServiceSpec) error {
updateString(flagName, &spec.Name)
updateLabels(flags, &spec.Labels)
updateString("image", &cspec.Image)
updateSlice("command", &cspec.Command)
updateSlice("arg", &cspec.Args)
updateListOpts("env", &cspec.Env)
updateString("workdir", &cspec.Dir)

Просмотреть файл

@ -7,20 +7,15 @@ import (
"github.com/docker/engine-api/types/swarm"
)
func TestUpdateServiceCommandAndArgs(t *testing.T) {
func TestUpdateServiceArgs(t *testing.T) {
flags := newUpdateCommand(nil).Flags()
flags.Set("command", "the")
flags.Set("command", "new")
flags.Set("command", "command")
flags.Set("arg", "the")
flags.Set("arg", "new args")
spec := &swarm.ServiceSpec{}
cspec := &spec.TaskTemplate.ContainerSpec
cspec.Command = []string{"old", "command"}
cspec.Args = []string{"old", "args"}
updateService(flags, spec)
assert.EqualStringSlice(t, cspec.Command, []string{"the", "new", "command"})
assert.EqualStringSlice(t, cspec.Args, []string{"the", "new args"})
}

Просмотреть файл

@ -1748,7 +1748,6 @@ _docker_service_update() {
if [ "$subcommand" = "update" ] ; then
options_with_args="$options_with_args
--arg
--command
--image
"

Просмотреть файл

@ -1154,7 +1154,6 @@ __docker_service_subcommand() {
$opts_help \
$opts_create_update \
"($help)--arg=[Service command args]:arguments: _normal" \
"($help)--command=[Service command]:command: _command_names -e" \
"($help)--image=[Service image tag]:image:__docker_repositories" \
"($help -)1:service:__docker_complete_services" && ret=0
;;

Просмотреть файл

@ -18,7 +18,6 @@ Update a service
Options:
--arg value Service command args (default [])
--command value Service command (default [])
--constraint value Placement constraints (default [])
--endpoint-mode string Endpoint mode (vip or dnsrr)
-e, --env value Set environment variables (default [])