From 54f070ef0f905f867a24dece72f667be23f9f843 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 1 Dec 2026 00:51:48 +0000 Subject: enstate: --apply starts the unit that runs --migrate again if it failed The setting unit names it (the module: enstate.service). After a boot without state it failed; an accepted --apply starts it (--no-block, with the lock released), so it serves the views and is no longer failed. --- src/plan.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/plan.rs') diff --git a/src/plan.rs b/src/plan.rs index b37510d..12c91b6 100644 --- a/src/plan.rs +++ b/src/plan.rs @@ -592,3 +592,23 @@ pub fn react(reactions: &Reactions, systemctl: &Path, how: Reacting) -> Vec Option { + let failed = Command::new(systemctl) + .args(["is-failed", "--quiet", unit]) + .status() + .is_ok_and(|status| status.success()); + if !failed { + return None; + } + match Command::new(systemctl) + .args(["start", "--no-block", unit]) + .status() + { + Ok(status) if status.success() => None, + Ok(status) => Some(format!("{} start {unit}: {status}", systemctl.display())), + Err(error) => Some(format!("{} start {unit}: {error}", systemctl.display())), + } +} -- cgit v1.3.1