ssh_doctor
drunc.apps.ssh_doctor
SSH Doctor Application
Validate the ability to SSH onto all of the hosts required by the configuration
Classes
Functions
check_host(host)
Validate SSH connectivity to a specific host.
Args:
host (str): The hostname or IP address of the target host.
Returns:
None
Raises:
None
Source code in drunc/apps/ssh_doctor.py
check_session(configuration, session)
Validate SSH connectivity for a configuration/session.
Validates the ability to SSH onto all of the hosts required by the
configuration
Args:
configuration (str): The configuration file name.
session (str): The session name defined within the given configuration (e.g.
'local-1x1-config'). The command validates SSH access for hosts required by
applications in this session.
Returns:
None
Raises:
None
Source code in drunc/apps/ssh_doctor.py
main(log_level)
Validate the ability to SSH onto all of the hosts required by the configuration
This command groups SSH connection validation using commands as:
drunc ssh-doctor check-session my_config.oks my_session
drunc ssh-doctor check-host myhost.example.com
Set the log level to error to see only failed connections.
Source code in drunc/apps/ssh_doctor.py
parse_configuration(configuration, session_name)
Parse configurations and collect unique hosts from applications in the given configuration and session.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
configuration
|
str
|
The configuration file name. |
required |
session_name
|
str
|
The session name defined within the given configuration (e.g. 'local-1x1-config'). The command validates SSH access for hosts required by applications in this session. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: A list of hostnames to test SSH connections to. |
Source code in drunc/apps/ssh_doctor.py
print_results(results)
Print the results of SSH connection tests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results
|
dict
|
A dictionary containing the results of SSH connection tests. Formatted as {host: {auth_method: success_bool}}. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Source code in drunc/apps/ssh_doctor.py
test_host_connection(host, test_auth)
Test SSH connection to a specific host using the given authentication method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
host
|
str
|
The hostname or IP address of the target host. |
required |
test_auth
|
str
|
The authentication method to use ('publickey', 'gssapi-with-mic', or None for both). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the SSH connection is successful, False otherwise. |