H2 owner-pass-with-units-stopped: the module's units and processes stop before the owner pass and start after it

Builds: design 47 H2 H-A-579 (1), H-A-602 (the pass back), H-A-641 (hq 6b8373ce), H-A-701 (hq 95cf2052)
This commit is contained in:
2026-11-25 17:09:52 +01:00
parent 204cd51e4b
commit 9c40b4a3fb
5 changed files with 179 additions and 5 deletions
+12
View File
@@ -18,9 +18,11 @@ import (
"encoding/json"
"errors"
"fmt"
"maps"
"os"
"os/exec"
"path/filepath"
"slices"
"sort"
"strconv"
"strings"
@@ -975,6 +977,16 @@ func applyScoped(
// not being up, and nothing of the machine would be applied.
var fetchFailures []*Error
fetchFirst(ctx, ordered, d, &in, &fetchFailures, gated, gatedWhy, log)
// **A module's units are stopped before the first owner pass of its directories** (design 47 H2, H-A-641): the apply
// below starts them again, and a pass that fails gates the module, so they stay stopped until a pass completes (H-A-701).
stopFailed := stopForOwnerPass(ctx, sys, d, known, in, run, log)
for _, module := range slices.Sorted(maps.Keys(stopFailed)) {
err := stopFailed[module]
failures = append(failures, &Error{Resource: module + " units stopped for an owner pass", Err: err, Done: report, Gated: true})
gated[module] = true
gatedWhy[module] = err.Error() + ", so nothing more of this module was attempted"
log(" failed " + module + ": " + err.Error())
}
for i, resource := range ordered {
if !orphansRemoved && i == guardFirst {
// **Only a guard that is up may let the filter go.** Removing the derived filter's