Skip to content

Commit c147924

Browse files
Remove unnecessary loop in stc-ng (#348668)
2 parents 6761106 + 7c828e9 commit c147924

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

nixos/tests/amazon-init-shell.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,21 @@ makeTest {
1818
meta = with maintainers; {
1919
maintainers = [ urbas ];
2020
};
21-
nodes.machine = { ... }:
21+
nodes.machine = { lib, pkgs, ... }:
2222
{
2323
imports = [ ../modules/profiles/headless.nix ../modules/virtualisation/amazon-init.nix ];
2424
services.openssh.enable = true;
25+
system.switch.enable = true;
2526
networking.hostName = "";
2627
environment.etc."ec2-metadata/user-data" = {
2728
text = ''
2829
#!/usr/bin/bash
2930
3031
echo successful > /tmp/evidence
32+
33+
# Emulate running nixos-rebuild switch, just without any building.
34+
# https://github.com/nixos/nixpkgs/blob/4c62505847d88f16df11eff3c81bf9a453a4979e/nixos/modules/virtualisation/amazon-init.nix#L55
35+
/run/current-system/bin/switch-to-configuration test
3136
'';
3237
};
3338
};

pkgs/by-name/sw/switch-to-configuration-ng/src/src/main.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,22 +1082,6 @@ won't take effect until you reboot the system.
10821082
.subscribe()
10831083
.context("Failed to subscribe to systemd dbus messages")?;
10841084

1085-
// Wait for the system to have finished booting.
1086-
loop {
1087-
let system_state: String = systemd
1088-
.get("org.freedesktop.systemd1.Manager", "SystemState")
1089-
.context("Failed to get system state")?;
1090-
1091-
match system_state.as_str() {
1092-
"running" | "degraded" | "maintenance" => break,
1093-
_ => {
1094-
_ = dbus_conn
1095-
.process(Duration::from_millis(500))
1096-
.context("Failed to process dbus messages")?
1097-
}
1098-
}
1099-
}
1100-
11011085
let _systemd_reload_status = systemd_reload_status.clone();
11021086
let reloading_token = systemd
11031087
.match_signal(

0 commit comments

Comments
 (0)