From b409913229de4dd870d7d5b33ef9cdfc492b182e Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Mon, 7 Jul 2025 15:38:09 +0200 Subject: [PATCH] docs/api: add docstrings to {check_machine_ssh_login} --- pkgs/clan-cli/clan_lib/ssh/remote.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkgs/clan-cli/clan_lib/ssh/remote.py b/pkgs/clan-cli/clan_lib/ssh/remote.py index 5356cf9ee..83e49b163 100644 --- a/pkgs/clan-cli/clan_lib/ssh/remote.py +++ b/pkgs/clan-cli/clan_lib/ssh/remote.py @@ -444,6 +444,21 @@ class CheckResult: def check_machine_ssh_login( remote: Remote, opts: ConnectionOptions | None = None ) -> CheckResult: + """Checks if a remote machine is reachable via SSH by attempting to run a simple command. + Args: + remote (Remote): The remote host to check for SSH login. + opts (ConnectionOptions, optional): Connection options such as timeout and number of retries. + If not provided, default values are used. + Returns: + CheckResult: An object indicating whether the SSH login is successful (`ok=True`) or not (`ok=False`), + and a reason if the check failed. + Usage: + result = check_machine_ssh_login(remote) + if result.ok: + print("SSH login successful") + else: + print(f"SSH login failed: {result.reason}") + """ if opts is None: opts = ConnectionOptions()