hecate: always clear startup intent on exit
This commit is contained in:
parent
6717cd1f3e
commit
ed7568d44d
@ -100,10 +100,12 @@ func (o *Orchestrator) Startup(ctx context.Context, opts StartupOptions) (err er
|
||||
return fmt.Errorf("set startup intent: %w", writeErr)
|
||||
}
|
||||
defer func() {
|
||||
if err == nil {
|
||||
if writeErr := state.MustWriteIntent(o.cfg.State.IntentPath, state.IntentNormal, opts.Reason, "startup"); writeErr != nil {
|
||||
o.log.Printf("warning: write startup completion intent failed: %v", writeErr)
|
||||
}
|
||||
finalReason := opts.Reason
|
||||
if err != nil {
|
||||
finalReason = fmt.Sprintf("%s (failed)", strings.TrimSpace(opts.Reason))
|
||||
}
|
||||
if writeErr := state.MustWriteIntent(o.cfg.State.IntentPath, state.IntentNormal, finalReason, "startup"); writeErr != nil {
|
||||
o.log.Printf("warning: write startup completion intent failed: %v", writeErr)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user