fix(matrix): the deferred starter logs the state its boot ended in
A degraded guest still starts the services, and now the journal says so next to the start. The VM test pins the line.
This commit is contained in:
parent
3919de6358
commit
c12e231d32
3 changed files with 9 additions and 3 deletions
|
|
@ -114,8 +114,10 @@ in
|
|||
path = [ pkgs.systemd ];
|
||||
serviceConfig.Type = "simple";
|
||||
script = ''
|
||||
# `degraded` (a unit of the boot failed) exits 1 and is still over.
|
||||
systemctl is-system-running --wait >/dev/null || true
|
||||
# `degraded` (a unit of the boot failed) exits 1 and is still over;
|
||||
# the state goes to the journal next to the start.
|
||||
state=$(systemctl is-system-running --wait || true)
|
||||
echo "swarm-container-deferred-start: the boot ended $state; starting ${lib.concatStringsSep " " cfg.startAfterReady}"
|
||||
systemctl start --no-block ${lib.concatMapStringsSep " " (n: "${n}.service") cfg.startAfterReady}
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1013,7 +1013,7 @@ let
|
|||
&& starter.wantedBy == [ "multi-user.target" ]
|
||||
&& starter.serviceConfig.Type == "simple"
|
||||
&& !(bootWait.holdsJob starter)
|
||||
&& lib.hasInfix "systemctl is-system-running --wait >/dev/null || true\nsystemctl start --no-block tuwunel.service" starter.script
|
||||
&& lib.hasInfix "state=$(systemctl is-system-running --wait || true)\necho \"swarm-container-deferred-start: the boot ended $state; starting tuwunel\"\nsystemctl start --no-block tuwunel.service" starter.script
|
||||
&& !(lib.elem "tuwunel.service" booted)
|
||||
&& lib.elem "swarm-container-deferred-start.service" booted
|
||||
&& lib.elem "swarm-matrix-appservice-sync.service" booted
|
||||
|
|
|
|||
|
|
@ -110,6 +110,10 @@ pkgs.testers.runNixOSTest {
|
|||
"test \"$(nixos-container run new -- systemctl show -p ActiveState --value slow.service)\" = activating",
|
||||
timeout=60,
|
||||
)
|
||||
# The starter says which state the boot ended in, next to the start.
|
||||
out = inside("new", "journalctl -u swarm-container-deferred-start.service --no-pager -o cat")
|
||||
assert "swarm-container-deferred-start: the boot ended " in out, out
|
||||
assert "starting slow" in out, out
|
||||
|
||||
with subtest("the dependant fails while the daemon starts"):
|
||||
assert inside("new", "systemctl show -p ActiveState --value client.service") != "active"
|
||||
|
|
|
|||
Loading…
Reference in a new issue