From 423d6928e513de97df138f81dfbf334936637db9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wilson=20J=C3=BAnior?= Date: Wed, 6 Sep 2023 14:31:31 -0300 Subject: [PATCH] Fix job update --- tsuru/client/jobs.go | 7 +------ tsuru/client/jobs_test.go | 3 +++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tsuru/client/jobs.go b/tsuru/client/jobs.go index 2592a8834..e1bbe34f9 100644 --- a/tsuru/client/jobs.go +++ b/tsuru/client/jobs.go @@ -481,7 +481,6 @@ type JobUpdate struct { plan string pool string description string - commands string image string envs cmd.StringSliceFlag privateEnvs cmd.StringSliceFlag @@ -493,10 +492,9 @@ type JobUpdate struct { func (c *JobUpdate) Info() *cmd.Info { return &cmd.Info{ Name: "job-update", - Usage: "job update [--image/-i ] [--commands/-c ] [--plan/-p plan name] [--schedule/-s schedule name] [--team/-t team owner] [--pool/-o pool name] [--description/-d description] [--tag/-g tag]...", + Usage: "job update [--image/-i ] [--plan/-p plan name] [--schedule/-s schedule name] [--team/-t team owner] [--pool/-o pool name] [--description/-d description] [--tag/-g tag]... -- [commands]", Desc: "Updates a job", MinArgs: 1, - MaxArgs: 1, } } @@ -526,9 +524,6 @@ func (c *JobUpdate) Flags() *gnuflag.FlagSet { c.fs.Var(&c.envs, "e", envMessage) envMessage = "Private environment variable" c.fs.Var(&c.privateEnvs, "private-env", envMessage) - commandsMessage := "New commands to execute on the job" - c.fs.StringVar(&c.commands, "commands", "", commandsMessage) - c.fs.StringVar(&c.commands, "c", "", commandsMessage) imageMessage := "New image for the job to run" c.fs.StringVar(&c.image, "image", "", imageMessage) c.fs.StringVar(&c.image, "i", "", imageMessage) diff --git a/tsuru/client/jobs_test.go b/tsuru/client/jobs_test.go index 3081b766a..d360adaba 100644 --- a/tsuru/client/jobs_test.go +++ b/tsuru/client/jobs_test.go @@ -624,6 +624,9 @@ func (s *S) TestJobUpdate(c *check.C) { } client := cmd.NewClient(&http.Client{Transport: &trans}, nil, manager) command := JobUpdate{} + c.Assert(command.Info().MinArgs, check.Equals, 1) + unlimitedMaxArgs := 0 + c.Assert(command.Info().MaxArgs, check.Equals, unlimitedMaxArgs) command.Flags().Parse(true, []string{"-i", "tsuru/scratch:latest"}) err := command.Run(&context, client) c.Assert(err, check.IsNil)