clan-cli: Fix deployment as non root with a buildHost set
This commit is contained in:
@@ -152,6 +152,7 @@ def deploy_machines(machines: list[Machine]) -> None:
|
|||||||
"--flake",
|
"--flake",
|
||||||
f"{path}#{machine.name}",
|
f"{path}#{machine.name}",
|
||||||
]
|
]
|
||||||
|
|
||||||
switch_cmd = ["nixos-rebuild", "switch", *nix_options]
|
switch_cmd = ["nixos-rebuild", "switch", *nix_options]
|
||||||
test_cmd = ["nixos-rebuild", "test", *nix_options]
|
test_cmd = ["nixos-rebuild", "test", *nix_options]
|
||||||
|
|
||||||
@@ -160,6 +161,10 @@ def deploy_machines(machines: list[Machine]) -> None:
|
|||||||
switch_cmd.extend(["--target-host", target_host.target])
|
switch_cmd.extend(["--target-host", target_host.target])
|
||||||
test_cmd.extend(["--target-host", target_host.target])
|
test_cmd.extend(["--target-host", target_host.target])
|
||||||
|
|
||||||
|
if target_host and target_host.user != "root":
|
||||||
|
switch_cmd.extend(["--use-remote-sudo"])
|
||||||
|
test_cmd.extend(["--use-remote-sudo"])
|
||||||
|
|
||||||
env = host.nix_ssh_env(None)
|
env = host.nix_ssh_env(None)
|
||||||
ret = host.run(
|
ret = host.run(
|
||||||
switch_cmd,
|
switch_cmd,
|
||||||
|
|||||||
Reference in New Issue
Block a user