From abd145aaaa4857369082c538b38a9476d385a28f Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Wed, 18 Dec 2024 00:05:19 +1100 Subject: [PATCH] clan_cli: always use `--target-host` if specified for `machines install` --- pkgs/clan-cli/clan_cli/machines/install.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkgs/clan-cli/clan_cli/machines/install.py b/pkgs/clan-cli/clan_cli/machines/install.py index 294e202db..d8075bdb4 100644 --- a/pkgs/clan-cli/clan_cli/machines/install.py +++ b/pkgs/clan-cli/clan_cli/machines/install.py @@ -135,23 +135,24 @@ def install_command(args: argparse.Namespace) -> None: msg = "Could not find clan flake toplevel directory" raise ClanError(msg) deploy_info: DeployInfo | None = ssh_command_parse(args) + password = None - if deploy_info: + if args.target_host: + target_host = args.target_host + elif deploy_info: host = find_reachable_host(deploy_info) if host is None: msg = f"Couldn't reach any host address: {deploy_info.addrs}" raise ClanError(msg) target_host = host.target - password = deploy_info.pwd - elif args.target_host: - target_host = args.target_host - password = None else: machine = Machine( name=args.machine, flake=args.flake, nix_options=args.option ) target_host = machine.target_host.host - password = None + + if deploy_info: + password = deploy_info.pwd if args.password: password = args.password