From 53d363306cdaa84d9c872a43bf4ccac3cedc3a89 Mon Sep 17 00:00:00 2001 From: Easton Crupper <65553218+ecrupper@users.noreply.github.com> Date: Thu, 19 Sep 2024 10:23:22 -0400 Subject: [PATCH] fix(worker): only set active when provided (#575) --- command/worker/update.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/command/worker/update.go b/command/worker/update.go index 2f48d0fc..802e31a0 100644 --- a/command/worker/update.go +++ b/command/worker/update.go @@ -94,24 +94,24 @@ func update(c *cli.Context) error { return err } - var active bool - - if len(c.String(internal.FlagActive)) > 0 { - active, err = strconv.ParseBool(c.String(internal.FlagActive)) - if err != nil { - return err - } - } - // create the worker configuration w := &worker.Config{ Hostname: c.String(internal.FlagWorkerHostname), Address: c.String(internal.FlagWorkerAddress), - Active: &active, Routes: c.StringSlice("routes"), BuildLimit: c.Int64("build-limit"), } + // if active flag provided, parse as bool and set in config + if len(c.String(internal.FlagActive)) > 0 { + active, err := strconv.ParseBool(c.String(internal.FlagActive)) + if err != nil { + return err + } + + w.Active = &active + } + // validate worker configuration // // https://pkg.go.dev/github.com/go-vela/cli/action/worker?tab=doc#Config.Validate