clan_lib: Remote add to arguments override func

This commit is contained in:
Qubasa
2025-09-20 16:18:14 +02:00
parent 8402463296
commit 8ff060c589
2 changed files with 5 additions and 3 deletions

View File

@@ -122,7 +122,7 @@ def upload_sources(machine: Machine, ssh: Host, upload_inputs: bool) -> str:
def run_machine_update( def run_machine_update(
machine: Machine, machine: Machine,
target_host: Remote | LocalHost, target_host: Remote | LocalHost,
build_host: Remote | LocalHost | None, build_host: Remote | LocalHost | None = None,
upload_inputs: bool = False, upload_inputs: bool = False,
) -> None: ) -> None:
"""Update an existing machine using nixos-rebuild or darwin-rebuild. """Update an existing machine using nixos-rebuild or darwin-rebuild.

View File

@@ -64,6 +64,8 @@ class Remote:
def override( def override(
self, self,
*, *,
user: str | None = None,
address: str | None = None,
host_key_check: HostKeyCheck | None = None, host_key_check: HostKeyCheck | None = None,
private_key: Path | None = None, private_key: Path | None = None,
password: str | None = None, password: str | None = None,
@@ -75,8 +77,8 @@ class Remote:
) -> "Remote": ) -> "Remote":
"""Returns a new Remote instance with the same data but with a different host_key_check.""" """Returns a new Remote instance with the same data but with a different host_key_check."""
return Remote( return Remote(
address=self.address, address=address or self.address,
user=self.user, user=user or self.user,
command_prefix=command_prefix or self.command_prefix, command_prefix=command_prefix or self.command_prefix,
port=port or self.port, port=port or self.port,
private_key=private_key if private_key is not None else self.private_key, private_key=private_key if private_key is not None else self.private_key,