MCPcopy Create free account
hub / github.com/cloudbase/garm / UpdateController

Method UpdateController

runner/runner.go:259–281  ·  view source on GitHub ↗

UpdateController will update the controller settings.

(ctx context.Context, param params.UpdateControllerParams)

Source from the content-addressed store, hash-verified

257
258// UpdateController will update the controller settings.
259func (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.

Callers

nothing calls this directly

Calls 3

IsAdminFunction · 0.92
UpdateControllerMethod · 0.65
ValidateMethod · 0.45

Tested by

no test coverage detected