From 409782d025cca6ae0f7cd26a17480f979942ceee Mon Sep 17 00:00:00 2001 From: illustris Date: Tue, 12 Dec 2023 09:40:12 +0530 Subject: nixos/cloud-init: fail test faster --- nixos/tests/cloud-init.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'nixos') diff --git a/nixos/tests/cloud-init.nix b/nixos/tests/cloud-init.nix index 786e01add7d4..0b4c5a55c80a 100644 --- a/nixos/tests/cloud-init.nix +++ b/nixos/tests/cloud-init.nix @@ -73,6 +73,7 @@ in makeTest { }; testScript = '' # To wait until cloud-init terminates its run + unnamed.wait_for_unit("cloud-init-local.service") unnamed.wait_for_unit("cloud-final.service") unnamed.succeed("cat /tmp/cloudinit-write-file | grep -q 'cloudinit'") -- cgit 1.4.1 From d6baaf1c42b41d5a43ff196bdbe10cf5864f87be Mon Sep 17 00:00:00 2001 From: illustris Date: Wed, 3 Jan 2024 23:37:02 +0530 Subject: nixos/cloud-init: fix DHCP race condition --- nixos/modules/services/system/cloud-init.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'nixos') diff --git a/nixos/modules/services/system/cloud-init.nix b/nixos/modules/services/system/cloud-init.nix index d782bb1a3666..00ae77be4271 100644 --- a/nixos/modules/services/system/cloud-init.nix +++ b/nixos/modules/services/system/cloud-init.nix @@ -164,7 +164,10 @@ in systemd.services.cloud-init-local = { description = "Initial cloud-init job (pre-networking)"; wantedBy = [ "multi-user.target" ]; - before = [ "systemd-networkd.service" ]; + # In certain environments (AWS for example), cloud-init-local will + # first configure an IP through DHCP, and later delete it. + # This can cause race conditions with anything else trying to set IP through DHCP. + before = [ "systemd-networkd.service" "dhcpcd.service" ]; path = path; serviceConfig = { Type = "oneshot"; -- cgit 1.4.1