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:
@@ -569,7 +569,12 @@ class ProcurveDriver(ConfigLifecycleMixin, SwitchDriver):
|
|||||||
if result.get("running"):
|
if result.get("running"):
|
||||||
return result
|
return result
|
||||||
# REST endpoint not available on this firmware (e.g. HP 2530 / YA series).
|
# 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()
|
running = self._get_config_via_ssh()
|
||||||
return {"running": running, "startup": "", "candidate": ""}
|
return {"running": running, "startup": "", "candidate": ""}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user