Serve reset-failed and wanted-by in the systemd module (hq issue 332)
mesh/merge-gate fail: builds systemd → ace, g14, novox, shanks; no bus step; a manifest the change touches fails the module check: systemd claims node-serv…
mesh/repo-check fail: its merge-check.sh failed: long-running resources without health: 70
mesh/delivery superseded: a newer head of the same pull request

So a leftover unit's trigger is found and its failed record cleared
through the seat, not a shell: wanted-by reads the manager's reverse
dependencies and the enable links naming the unit, saying which dangle.
This commit is contained in:
jochen
2026-10-08 17:21:18 +02:00
parent bf542128ee
commit 00f1d04616
6 changed files with 558 additions and 8 deletions
+7 -2
View File
@@ -98,7 +98,7 @@ func execRunner(cmd string, args []string, env []string) Ran {
const MeshUnitHeader = "# Generated by the mesh."
// acts are the verbs that change the system manager's state, which polkit keeps from a non-root account.
var acts = map[string]bool{"start": true, "stop": true, "restart": true, "enable": true, "disable": true}
var acts = map[string]bool{"start": true, "stop": true, "restart": true, "enable": true, "disable": true, "reset-failed": true}
// escalated is the command as it is run: as given when this process is root, or in the user scope, or
// when the call is a systemctl read; else through sudo without a prompt — an act on the system manager,
@@ -137,6 +137,10 @@ type Manager struct {
Read func(path string) (string, error)
// Env is this process's environment, the base of a user-scope call's.
Env []string
// Home is the operator account's home, whose configuration holds its own enable links.
Home string
// ReadDir lists a directory, to find the enable links naming a unit (wanted.go).
ReadDir func(dir string) ([]Entry, error)
}
var userBus = regexp.MustCompile(`(?i)Failed to connect to (user scope )?bus`)
@@ -267,7 +271,8 @@ func (m *Manager) writtenByMesh(path string) bool {
return err == nil && strings.HasPrefix(text, MeshUnitHeader)
}
// Act starts, stops, restarts, enables or disables one unit, and answers with the state after.
// Act starts, stops, restarts, enables or disables one unit, or resets its failed record, and answers with
// the state after.
func (m *Manager) Act(scope Scope, verb, unit string) (map[string]any, error) {
if err := unitArg(unit); err != nil {
return nil, err