deploy: cancelled job restores the previous machine state; site: deployment features

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Fable 5.1 committed 2026-10-27 10:13:16 +01:00
1 parent fad4e1c8bd
commit ee3a1a4787
2 files changed
+14

No files matched your search

+11
View File
@@ -528,6 +528,17 @@ func (a *App) afterJob(ctx context.Context, m *Machine, j *Job, state, errMsg st
m, _ = a.store.Get(ctx, m.ID)
_ = a.writePXE(m)
_ = a.store.AddEvent(ctx, m.ID, "released", fmt.Sprintf("job=%s disk=%s wipe=%s", j.ID, sp.Disk, sp.Wipe))
case state == "cancelled":
// nothing happened on the machine (as far as we know): back to the previous state
if m.OS != nil {
_ = a.store.SetState(ctx, m.ID, "deployed")
m, _ = a.store.Get(ctx, m.ID)
_ = a.writePXEDeployed(m)
} else {
_ = a.store.SetState(ctx, m.ID, "ready")
_ = a.writePXE(m)
}
_ = a.store.AddEvent(ctx, m.ID, j.Kind+" cancelled", "job="+j.ID)
default:
_ = a.store.SetState(ctx, m.ID, j.Kind+"-failed")
m, _ = a.store.Get(ctx, m.ID)