update/upload_sources remove ssh_control_master again from upload_sources

This commit is contained in:
Jörg Thalheim
2025-05-27 11:52:52 +02:00
parent cedc5113ea
commit 2ef379b4df

View File

@@ -44,14 +44,11 @@ def is_local_input(node: dict[str, dict[str, str]]) -> bool:
return local
def upload_sources(machine: Machine, host: Remote) -> str:
with host.ssh_control_master() as ssh:
def upload_sources(machine: Machine, ssh: Remote) -> str:
env = ssh.nix_ssh_env(os.environ.copy())
flake_url = (
str(machine.flake.path)
if machine.flake.is_local
else machine.flake.identifier
str(machine.flake.path) if machine.flake.is_local else machine.flake.identifier
)
flake_data = nix_metadata(flake_url)
has_path_inputs = any(
@@ -65,7 +62,7 @@ def upload_sources(machine: Machine, host: Remote) -> str:
[
"copy",
"--to",
f"ssh://{host.target}",
f"ssh://{ssh.target}",
"--no-check-sigs",
path,
]
@@ -87,7 +84,7 @@ def upload_sources(machine: Machine, host: Remote) -> str:
"flake",
"archive",
"--to",
f"ssh://{host.target}",
f"ssh://{ssh.target}",
"--json",
flake_url,
]
@@ -102,9 +99,7 @@ def upload_sources(machine: Machine, host: Remote) -> str:
try:
return json.loads(proc.stdout)["path"]
except (json.JSONDecodeError, OSError) as e:
msg = (
f"failed to parse output of {shlex.join(cmd)}: {e}\nGot: {proc.stdout}"
)
msg = f"failed to parse output of {shlex.join(cmd)}: {e}\nGot: {proc.stdout}"
raise ClanError(msg) from e