UpdateController will update the controller settings.
(ctx context.Context, param params.UpdateControllerParams)
| 257 | |
| 258 | // UpdateController will update the controller settings. |
| 259 | func (r *Runner) UpdateController(ctx context.Context, param params.UpdateControllerParams) (params.ControllerInfo, error) { |
| 260 | if !auth.IsAdmin(ctx) { |
| 261 | return params.ControllerInfo{}, runnerErrors.ErrUnauthorized |
| 262 | } |
| 263 | |
| 264 | if err := param.Validate(); err != nil { |
| 265 | return params.ControllerInfo{}, fmt.Errorf("error validating controller update params: %w", err) |
| 266 | } |
| 267 | |
| 268 | if len(param.CACertBundle) > 0 { |
| 269 | sanitized, err := util.SanitizeCABundle(param.CACertBundle) |
| 270 | if err != nil { |
| 271 | return params.ControllerInfo{}, fmt.Errorf("failed to sanitize CA bundle: %w", err) |
| 272 | } |
| 273 | param.CACertBundle = sanitized |
| 274 | } |
| 275 | |
| 276 | info, err := r.store.UpdateController(param) |
| 277 | if err != nil { |
| 278 | return params.ControllerInfo{}, fmt.Errorf("error updating controller info: %w", err) |
| 279 | } |
| 280 | return info, nil |
| 281 | } |
| 282 | |
| 283 | // ForceToolsSync forces an immediate sync of GARM agent tools by resetting the cached timestamp. |
| 284 | // This triggers the garmToolsSync worker to fetch and sync tools on the next check. |
nothing calls this directly
no test coverage detected