diff --git a/cmd/garm-cli/cmd/pool.go b/cmd/garm-cli/cmd/pool.go index 574f650b..4eb4687a 100644 --- a/cmd/garm-cli/cmd/pool.go +++ b/cmd/garm-cli/cmd/pool.go @@ -254,7 +254,7 @@ explicitly remove them using the runner delete command. } if cmd.Flags().Changed("runner-bootstrap-timeout") { - poolUpdateParams.RunnerBootstrapTimeout = poolRunnerBootstrapTimeout + poolUpdateParams.RunnerBootstrapTimeout = &poolRunnerBootstrapTimeout } pool, err := cli.UpdatePoolByID(args[0], poolUpdateParams) diff --git a/database/sql/util.go b/database/sql/util.go index 3852845e..40f640ba 100644 --- a/database/sql/util.go +++ b/database/sql/util.go @@ -210,8 +210,8 @@ func (s *sqlDatabase) updatePool(pool Pool, param params.UpdatePoolParams) (para pool.OSType = param.OSType } - if param.RunnerBootstrapTimeout > 0 { - pool.RunnerBootstrapTimeout = param.RunnerBootstrapTimeout + if param.RunnerBootstrapTimeout != nil && *param.RunnerBootstrapTimeout > 0 { + pool.RunnerBootstrapTimeout = *param.RunnerBootstrapTimeout } if q := s.conn.Save(&pool); q.Error != nil { diff --git a/params/requests.go b/params/requests.go index 30deab74..1f51bfa4 100644 --- a/params/requests.go +++ b/params/requests.go @@ -78,11 +78,11 @@ type NewUserParams struct { } type UpdatePoolParams struct { - Tags []string `json:"tags"` - Enabled *bool `json:"enabled"` - MaxRunners *uint `json:"max_runners"` - MinIdleRunners *uint `json:"min_idle_runners"` - RunnerBootstrapTimeout uint `json:"runner_bootstrap_timeout"` + Tags []string `json:"tags,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + MaxRunners *uint `json:"max_runners,omitempty"` + MinIdleRunners *uint `json:"min_idle_runners,omitempty"` + RunnerBootstrapTimeout *uint `json:"runner_bootstrap_timeout,omitempty"` Image string `json:"image"` Flavor string `json:"flavor"` OSType config.OSType `json:"os_type"` diff --git a/runner/pools.go b/runner/pools.go index 54c59c55..060f7cbd 100644 --- a/runner/pools.go +++ b/runner/pools.go @@ -90,7 +90,7 @@ func (r *Runner) UpdatePoolByID(ctx context.Context, poolID string, param params minIdleRunners = *param.MinIdleRunners } - if param.RunnerBootstrapTimeout == 0 { + if param.RunnerBootstrapTimeout != nil && *param.RunnerBootstrapTimeout == 0 { return params.Pool{}, runnerErrors.NewBadRequestError("runner_bootstrap_timeout cannot be 0") }