docs/api: add docstrings to {check_machine_ssh_login}
This commit is contained in:
@@ -444,6 +444,21 @@ class CheckResult:
|
|||||||
def check_machine_ssh_login(
|
def check_machine_ssh_login(
|
||||||
remote: Remote, opts: ConnectionOptions | None = None
|
remote: Remote, opts: ConnectionOptions | None = None
|
||||||
) -> CheckResult:
|
) -> 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:
|
if opts is None:
|
||||||
opts = ConnectionOptions()
|
opts = ConnectionOptions()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user