diff --git a/pkgs/clan-cli/clan_cli/backups/create.py b/pkgs/clan-cli/clan_cli/backups/create.py index b119b58d..b8573794 100644 --- a/pkgs/clan-cli/clan_cli/backups/create.py +++ b/pkgs/clan-cli/clan_cli/backups/create.py @@ -13,7 +13,7 @@ def create_backup(machine: Machine, provider: str | None = None) -> None: backup_scripts = json.loads(machine.eval_nix("config.clanCore.backups")) if provider is None: for provider in backup_scripts["providers"]: - proc = machine.host.run( + proc = machine.target_host.run( ["bash", "-c", backup_scripts["providers"][provider]["create"]], ) if proc.returncode != 0: @@ -23,7 +23,7 @@ def create_backup(machine: Machine, provider: str | None = None) -> None: else: if provider not in backup_scripts["providers"]: raise ClanError(f"provider {provider} not found") - proc = machine.host.run( + proc = machine.target_host.run( ["bash", "-c", backup_scripts["providers"][provider]["create"]], ) if proc.returncode != 0: diff --git a/pkgs/clan-cli/clan_cli/backups/list.py b/pkgs/clan-cli/clan_cli/backups/list.py index 039bb792..b357cf36 100644 --- a/pkgs/clan-cli/clan_cli/backups/list.py +++ b/pkgs/clan-cli/clan_cli/backups/list.py @@ -19,7 +19,7 @@ class Backup: def list_provider(machine: Machine, provider: str) -> list[Backup]: results = [] backup_metadata = json.loads(machine.eval_nix("config.clanCore.backups")) - proc = machine.host.run( + proc = machine.target_host.run( ["bash", "-c", backup_metadata["providers"][provider]["list"]], stdout=subprocess.PIPE, check=False, diff --git a/pkgs/clan-cli/clan_cli/backups/restore.py b/pkgs/clan-cli/clan_cli/backups/restore.py index 7f168f91..3a24a1f9 100644 --- a/pkgs/clan-cli/clan_cli/backups/restore.py +++ b/pkgs/clan-cli/clan_cli/backups/restore.py @@ -20,7 +20,7 @@ def restore_service( env["JOB"] = backup.job_name env["FOLDERS"] = ":".join(folders) - proc = machine.host.run( + proc = machine.target_host.run( [ "bash", "-c", @@ -34,7 +34,7 @@ def restore_service( f"failed to run preRestoreScript: {backup_folders[service]['preRestoreScript']}, error was: {proc.stdout}" ) - proc = machine.host.run( + proc = machine.target_host.run( [ "bash", "-c", @@ -48,7 +48,7 @@ def restore_service( f"failed to restore backup: {backup_metadata['providers'][provider]['restore']}" ) - proc = machine.host.run( + proc = machine.target_host.run( [ "bash", "-c", diff --git a/pkgs/clan-cli/clan_cli/machines/install.py b/pkgs/clan-cli/clan_cli/machines/install.py index 36230b1f..701303fe 100644 --- a/pkgs/clan-cli/clan_cli/machines/install.py +++ b/pkgs/clan-cli/clan_cli/machines/install.py @@ -19,7 +19,7 @@ def install_nixos(machine: Machine, kexec: str | None = None) -> None: log.info(f"using secret store: {secrets_module.SecretStore}") secret_store = secrets_module.SecretStore(machine=machine) - h = machine.host + h = machine.target_host target_host = f"{h.user or 'root'}@{h.host}" log.info(f"target host: {target_host}") diff --git a/pkgs/clan-cli/clan_cli/machines/machines.py b/pkgs/clan-cli/clan_cli/machines/machines.py index 26d6e53e..d02319e0 100644 --- a/pkgs/clan-cli/clan_cli/machines/machines.py +++ b/pkgs/clan-cli/clan_cli/machines/machines.py @@ -92,7 +92,7 @@ class Machine: return Path(self.flake_path) @property - def host(self) -> Host: + def target_host(self) -> Host: return parse_deployment_address( self.name, self.target_host_address, meta={"machine": self} ) diff --git a/pkgs/clan-cli/clan_cli/machines/update.py b/pkgs/clan-cli/clan_cli/machines/update.py index 5d63e2a0..a83b1732 100644 --- a/pkgs/clan-cli/clan_cli/machines/update.py +++ b/pkgs/clan-cli/clan_cli/machines/update.py @@ -182,7 +182,7 @@ def get_selected_machines(machine_names: list[str], flake_dir: Path) -> HostGrou hosts = [] for name in machine_names: machine = Machine(name=name, flake=flake_dir) - hosts.append(machine.host) + hosts.append(machine.target_host) return HostGroup(hosts) diff --git a/pkgs/clan-cli/clan_cli/secrets/modules/password_store.py b/pkgs/clan-cli/clan_cli/secrets/modules/password_store.py index 20d4abcd..cc06c34b 100644 --- a/pkgs/clan-cli/clan_cli/secrets/modules/password_store.py +++ b/pkgs/clan-cli/clan_cli/secrets/modules/password_store.py @@ -86,7 +86,7 @@ class SecretStore: def update_check(self) -> bool: local_hash = self.generate_hash() - remote_hash = self.machine.host.run( + remote_hash = self.machine.target_host.run( # TODO get the path to the secrets from the machine ["cat", f"{self.machine.secrets_upload_directory}/.pass_info"], check=False, diff --git a/pkgs/clan-cli/clan_cli/secrets/upload.py b/pkgs/clan-cli/clan_cli/secrets/upload.py index 796b73f0..420136e3 100644 --- a/pkgs/clan-cli/clan_cli/secrets/upload.py +++ b/pkgs/clan-cli/clan_cli/secrets/upload.py @@ -22,7 +22,7 @@ def upload_secrets(machine: Machine) -> None: return with TemporaryDirectory() as tempdir: secret_store.upload(Path(tempdir)) - host = machine.host + host = machine.target_host ssh_cmd = host.ssh_cmd() run(