fix(get_config): cap SSH fallback timeout at 8s to prevent poll timeout

Each SSH attempt was using driver timeout (30s). With 2 attempts that
consumed the entire poll budget → device marked OFFLINE. Now capped at
8s per attempt (max 16s total), well within the 30s poll limit.
This commit is contained in:
Christian Manivong
2026-06-29 13:42:05 +02:00
parent 0d53426636
commit 8a182c4fa4
+7 -3
View File
@@ -590,13 +590,17 @@ class ProcurveDriver(ConfigLifecycleMixin, SwitchDriver):
"""Open a one-shot SSH session to retrieve running-config. """Open a one-shot SSH session to retrieve running-config.
Used as fallback when the REST API does not expose the config endpoint Used as fallback when the REST API does not expose the config endpoint
(e.g. HP 2530 / YA firmware with Mocana SSH). Tries legacy KEX (e.g. HP 2530 / YA firmware). Tries legacy KEX first (required for
algorithms first (required for older ProCurve firmware), then standard. older ProCurve firmware), then standard. Each attempt is capped at
8 seconds so this fallback never pushes the overall poll over budget.
Returns empty string on any failure. Returns empty string on any failure.
""" """
_FALLBACK_TIMEOUT = 8 # seconds per attempt — keeps total ≤ 16 s
for legacy in (True, False): for legacy in (True, False):
try: try:
conn = ConnectHandler(**self._netmiko_kwargs(legacy=legacy)) kwargs = self._netmiko_kwargs(legacy=legacy)
kwargs["timeout"] = _FALLBACK_TIMEOUT
conn = ConnectHandler(**kwargs)
try: try:
return conn.send_command("show running-config") return conn.send_command("show running-config")
finally: finally: