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

Method UpdateSystemInfo

runner/runner.go:974–1000  ·  view source on GitHub ↗
(ctx context.Context, param params.UpdateSystemInfoParams)

Source from the content-addressed store, hash-verified

972}
973
974func (r *Runner) UpdateSystemInfo(ctx context.Context, param params.UpdateSystemInfoParams) error {
975 instanceName := auth.InstanceName(ctx)
976 if instanceName == "" {
977 slog.ErrorContext(ctx, "missing instance name")
978 return runnerErrors.ErrUnauthorized
979 }
980
981 if param.OSName == "" && param.OSVersion == "" && param.AgentID == nil {
982 // Nothing to update
983 return nil
984 }
985
986 updateParams := params.UpdateInstanceParams{
987 OSName: param.OSName,
988 OSVersion: param.OSVersion,
989 }
990
991 if param.AgentID != nil {
992 updateParams.AgentID = *param.AgentID
993 }
994
995 if _, err := r.store.UpdateInstance(r.ctx, instanceName, updateParams); err != nil {
996 return fmt.Errorf("error updating runner system info: %w", err)
997 }
998
999 return nil
1000}
1001
1002func (r *Runner) getPoolManagerFromInstance(ctx context.Context, instance params.Instance) (common.PoolManager, error) {
1003 pool, err := r.store.GetPoolByID(ctx, instance.PoolID)

Callers 1

Calls 2

InstanceNameFunction · 0.92
UpdateInstanceMethod · 0.65

Tested by

no test coverage detected