apply: reload units only for a unit file actually written or removed (issue 1126)
mesh/delivery merged: source.main moved to novox/mesh-host@a548a61e86d7
mesh/delivery-group group fix/shutdown-bound merged: every member is merged
mesh/check pass bc28606d4566 on 690aa662a837 | unit 2192 run, 3794 kept, 57 skipped | integration 2208 run, 3829 kept, 57 skipped | over bound: unit, …

A skipped or held file comes back on every apply; counting it would reload the
service manager on every apply of a node with a gated or held module. The same
allowlist as MovesRoot: created, updated, corrected, removed.
This commit is contained in:
2026-10-28 15:49:34 +01:00
parent 7f0eb9c51d
commit bc28606d45
2 changed files with 12 additions and 2 deletions
+5 -2
View File
@@ -2018,11 +2018,14 @@ var UnitDirs = []string{"/etc/systemd/system", "/run/systemd/system", "/usr/loca
// or "" when it moved none. // or "" when it moved none.
func unitFileMoved(outcomes []Outcome) string { func unitFileMoved(outcomes []Outcome) string {
for _, o := range outcomes { for _, o := range outcomes {
if declaration.Type(o.Type) != declaration.TypeFile || !moved(o) { // Only what changed the file on disk, as MovesRoot reads it: skipped, held, kept, forgotten and waiting come
// back on every apply and change nothing.
if declaration.Type(o.Type) != declaration.TypeFile {
continue continue
} }
switch o.Action { switch o.Action {
case "kept", "forgotten", "waiting": case "created", "updated", "corrected", "removed":
default:
continue continue
} }
at := filepath.Clean(o.Target) at := filepath.Clean(o.Target)
+7
View File
@@ -1300,6 +1300,13 @@ func TestAServiceIsRestartedWhenWhatItReflectsChanges(t *testing.T) {
t.Errorf("%s: %d reloads, want %d; commands were %v", row.name, reloads, row.reloads, commands) t.Errorf("%s: %d reloads, want %d; commands were %v", row.name, reloads, row.reloads, commands)
} }
} }
// A drop-in whose module is skipped behind its step, or held as found, comes back so on every apply: it moved
// nothing, and reloads nothing.
for _, action := range []string{"skipped", "held"} {
if at := unitFileMoved([]Outcome{{ID: "bound", Type: "file", Target: dropIn, Action: action}}); at != "" {
t.Errorf("a drop-in %s reloads the service manager (%s)", action, at)
}
}
} }
} }