fix(get_config): close REST session before SSH fallback

HP ProCurve switches allow only 1 session per user. The REST API session
blocks SSH — closing it before the SSH attempt allows the connection.
_collect_config() is called last so all poll data is already collected.
This commit is contained in:
Christian Manivong
2026-06-29 15:05:34 +02:00
parent a496f02aa9
commit fe8df73ad6
+6 -1
View File
@@ -569,7 +569,12 @@ class ProcurveDriver(ConfigLifecycleMixin, SwitchDriver):
if result.get("running"):
return result
# REST endpoint not available on this firmware (e.g. HP 2530 / YA series).
# Fall back to a temporary SSH connection to run show running-config.
# HP switches allow only one session per user — close the REST session
# first so the switch accepts the SSH connection.
try:
self._api._session.close()
except Exception:
pass
running = self._get_config_via_ssh()
return {"running": running, "startup": "", "candidate": ""}