nixos/incus: preseed should not trigger socket-activation

This commit is contained in:
Adam Stephens 2023-10-27 18:05:58 -04:00
parent 1fff6a9031
commit 3087595a6b
No known key found for this signature in database
3 changed files with 8 additions and 9 deletions

View File

@ -194,9 +194,11 @@ in
systemd.services.incus-preseed = lib.mkIf (cfg.preseed != null) {
description = "Incus initialization with preseed file";
wantedBy = [ "multi-user.target" ];
requires = [ "incus.service" ];
after = [ "incus.service" ];
wantedBy = ["incus.service"];
after = ["incus.service"];
bindsTo = ["incus.service"];
partOf = ["incus.service"];
script = ''
${cfg.package}/bin/incus admin init --preseed <${
@ -206,6 +208,7 @@ in
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
};

View File

@ -49,13 +49,8 @@ import ../make-test-python.nix ({ pkgs, lib, ... } :
};
testScript = ''
def wait_for_preseed(_) -> bool:
_, output = machine.systemctl("is-active incus-preseed.service")
return ("inactive" in output)
machine.wait_for_unit("incus.service")
with machine.nested("Waiting for preseed to complete"):
retry(wait_for_preseed)
machine.wait_for_unit("incus-preseed.service")
with subtest("Verify preseed resources created"):
machine.succeed("incus profile show nixostest_default")

View File

@ -17,6 +17,7 @@ import ../make-test-python.nix ({ pkgs, lib, ... } :
# ensure service is not running by default
machine.fail("systemctl is-active incus.service")
machine.fail("systemctl is-active incus-preseed.service")
# access the socket and ensure the service starts
machine.succeed("incus list")