clan-lib: Rename parse_deployment_address to parse_ssh_uri

This commit is contained in:
Qubasa
2025-06-23 15:32:35 +02:00
parent 255f2da358
commit 071151f300
8 changed files with 13 additions and 15 deletions

View File

@@ -258,8 +258,6 @@ def get_host(
return None
return RemoteSource(
data=Remote.from_deployment_address(
machine_name=machine.name, address=host_str
),
data=Remote.from_ssh_uri(machine_name=machine.name, address=host_str),
source=source,
)

View File

@@ -8,7 +8,7 @@ if TYPE_CHECKING:
from clan_lib.ssh.remote import Remote
def parse_deployment_address(
def parse_ssh_uri(
*,
machine_name: str,
address: str,

View File

@@ -21,7 +21,7 @@ from clan_lib.colors import AnsiColor
from clan_lib.errors import ClanError # Assuming these are available
from clan_lib.nix import nix_shell
from clan_lib.ssh.host_key import HostKeyCheck, hostkey_to_ssh_opts
from clan_lib.ssh.parse import parse_deployment_address
from clan_lib.ssh.parse import parse_ssh_uri
from clan_lib.ssh.sudo_askpass_proxy import SudoAskpassProxy
cmdlog = logging.getLogger(__name__)
@@ -90,7 +90,7 @@ class Remote:
return f"{self.user}@{self.address}"
@classmethod
def from_deployment_address(
def from_ssh_uri(
cls,
*,
machine_name: str,
@@ -100,7 +100,7 @@ class Remote:
Parse a deployment address and return a Host object.
"""
return parse_deployment_address(machine_name=machine_name, address=address)
return parse_ssh_uri(machine_name=machine_name, address=address)
def run_local(
self,

View File

@@ -110,7 +110,7 @@ def test_parse_deployment_address(
with maybe_check_exception:
machine_name = "foo"
result = Remote.from_deployment_address(
result = Remote.from_ssh_uri(
machine_name=machine_name,
address=test_addr,
).override(host_key_check="strict")
@@ -130,7 +130,7 @@ def test_parse_deployment_address(
def test_parse_ssh_options() -> None:
addr = "root@example.com:2222?IdentityFile=/path/to/private/key&StrictRemoteKeyChecking=yes"
host = Remote.from_deployment_address(machine_name="foo", address=addr).override(
host = Remote.from_ssh_uri(machine_name="foo", address=addr).override(
host_key_check="strict"
)
assert host.address == "example.com"