MCPcopy Create free account
hub / github.com/compozy/agh / rollbackAppliedUpdate

Function rollbackAppliedUpdate

internal/cli/update.go:398–419  ·  view source on GitHub ↗
(
	ctx context.Context,
	manager updateManager,
	applied aghupdate.AppliedBinary,
	deps commandDeps,
	runtime *runtimeContext,
	attemptRecoveryStart bool,
)

Source from the content-addressed store, hash-verified

396}
397
398func rollbackAppliedUpdate(
399 ctx context.Context,
400 manager updateManager,
401 applied aghupdate.AppliedBinary,
402 deps commandDeps,
403 runtime *runtimeContext,
404 attemptRecoveryStart bool,
405) error {
406 var combined error
407 if err := manager.Restore(applied); err != nil {
408 combined = errors.Join(combined, err)
409 }
410 if !attemptRecoveryStart || runtime == nil {
411 return combined
412 }
413 if _, running, err := daemonInfo(runtime.HomePaths, deps); err == nil && !running {
414 if _, startErr := runDaemonDetached(ctx, deps); startErr != nil {
415 combined = errors.Join(combined, startErr)
416 }
417 }
418 return combined
419}
420
421func combineUpdateErrors(prefix string, primary error, secondary error) string {
422 parts := []string{strings.TrimSpace(prefix)}

Callers 1

failAppliedUpdateFunction · 0.85

Calls 3

daemonInfoFunction · 0.85
runDaemonDetachedFunction · 0.85
RestoreMethod · 0.65

Tested by

no test coverage detected