Remove unnecessary loop in stc-ng (#348668)

This commit is contained in:
Will Fancher 2024-10-23 23:42:34 -04:00 committed by GitHub
commit c1479242ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 17 deletions

View File

@ -18,16 +18,21 @@ makeTest {
meta = with maintainers; {
maintainers = [ urbas ];
};
nodes.machine = { ... }:
nodes.machine = { lib, pkgs, ... }:
{
imports = [ ../modules/profiles/headless.nix ../modules/virtualisation/amazon-init.nix ];
services.openssh.enable = true;
system.switch.enable = true;
networking.hostName = "";
environment.etc."ec2-metadata/user-data" = {
text = ''
#!/usr/bin/bash
echo successful > /tmp/evidence
# Emulate running nixos-rebuild switch, just without any building.
# https://github.com/nixos/nixpkgs/blob/4c62505847d88f16df11eff3c81bf9a453a4979e/nixos/modules/virtualisation/amazon-init.nix#L55
/run/current-system/bin/switch-to-configuration test
'';
};
};

View File

@ -1082,22 +1082,6 @@ won't take effect until you reboot the system.
.subscribe()
.context("Failed to subscribe to systemd dbus messages")?;
// Wait for the system to have finished booting.
loop {
let system_state: String = systemd
.get("org.freedesktop.systemd1.Manager", "SystemState")
.context("Failed to get system state")?;
match system_state.as_str() {
"running" | "degraded" | "maintenance" => break,
_ => {
_ = dbus_conn
.process(Duration::from_millis(500))
.context("Failed to process dbus messages")?
}
}
}
let _systemd_reload_status = systemd_reload_status.clone();
let reloading_token = systemd
.match_signal(