feat: get_management_peer, the address the host sees the SSH connection come from
CI / test (3.10) (push) Failing after 16s
CI / test (3.11) (push) Failing after 14s
CI / test (3.12) (push) Failing after 16s
CI / test (3.10) (pull_request) Failing after 15s
CI / test (3.11) (pull_request) Failing after 14s
CI / test (3.12) (pull_request) Failing after 15s
CI / test (3.10) (push) Failing after 16s
CI / test (3.11) (push) Failing after 14s
CI / test (3.12) (push) Failing after 16s
CI / test (3.10) (pull_request) Failing after 15s
CI / test (3.11) (pull_request) Failing after 14s
CI / test (3.12) (pull_request) Failing after 15s
From SSH_CONNECTION's client side; None when it is empty or no address. The caller uses it to choose the sources an SNMP agent answers.
This commit is contained in:
1 parent
1bc54b66e8
commit
ec8668476a
2 files changed
+28
No files matched your search
@@ -1999,6 +1999,14 @@ class LinuxDriver(
|
||||
output = f"{output}\n{_SUDO_PASSWORD_HINT}"
|
||||
return {"ok": status == 0, "output": (output.strip()[-300:] if status != 0 else done)}
|
||||
|
||||
def get_management_peer(self) -> str | None:
|
||||
"""The address this host sees the SSH connection come from (``SSH_CONNECTION``)."""
|
||||
out = self.run_command('printf "%s\\n" "$SSH_CONNECTION"', timeout=15).stdout.split()
|
||||
try:
|
||||
return str(ipaddress.ip_address(out[0])) if out else None
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
def _install_snmp_agent(self) -> FixStepOutcomeDict:
|
||||
pm = self._pkg_manager or self._detect_pkg_manager()
|
||||
command = _SNMP_INSTALL.get(pm or "")
|
||||
|
||||
Reference in new issue
Block a user