From 8a182c4fa49d7975369ca130ee7b02065fa088d1 Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Mon, 29 Jun 2026 13:42:05 +0200 Subject: [PATCH] fix(get_config): cap SSH fallback timeout at 8s to prevent poll timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- napalm_procurve/procurve.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/napalm_procurve/procurve.py b/napalm_procurve/procurve.py index 833f6db..4a1432c 100644 --- a/napalm_procurve/procurve.py +++ b/napalm_procurve/procurve.py @@ -590,13 +590,17 @@ class ProcurveDriver(ConfigLifecycleMixin, SwitchDriver): """Open a one-shot SSH session to retrieve running-config. 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 - algorithms first (required for older ProCurve firmware), then standard. + (e.g. HP 2530 / YA firmware). Tries legacy KEX first (required for + 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. """ + _FALLBACK_TIMEOUT = 8 # seconds per attempt — keeps total ≤ 16 s for legacy in (True, False): try: - conn = ConnectHandler(**self._netmiko_kwargs(legacy=legacy)) + kwargs = self._netmiko_kwargs(legacy=legacy) + kwargs["timeout"] = _FALLBACK_TIMEOUT + conn = ConnectHandler(**kwargs) try: return conn.send_command("show running-config") finally: