fix(get_config): try legacy KEX first in SSH fallback for HP 2530/Mocana SSH
This commit is contained in:
@@ -590,17 +590,26 @@ 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). Returns empty string on any failure.
|
(e.g. HP 2530 / YA firmware with Mocana SSH). Tries legacy KEX
|
||||||
|
algorithms first (required for older ProCurve firmware), then standard.
|
||||||
|
Returns empty string on any failure.
|
||||||
"""
|
"""
|
||||||
try:
|
for legacy in (True, False):
|
||||||
conn = ConnectHandler(**self._netmiko_kwargs())
|
|
||||||
try:
|
try:
|
||||||
return conn.send_command("show running-config")
|
conn = ConnectHandler(**self._netmiko_kwargs(legacy=legacy))
|
||||||
finally:
|
try:
|
||||||
conn.disconnect()
|
return conn.send_command("show running-config")
|
||||||
except Exception as exc:
|
finally:
|
||||||
logger.warning("SSH config fallback failed for %s: %s", self.hostname, exc)
|
conn.disconnect()
|
||||||
return ""
|
except Exception as exc:
|
||||||
|
logger.debug(
|
||||||
|
"SSH config fallback (%s) failed for %s: %s",
|
||||||
|
"legacy" if legacy else "standard",
|
||||||
|
self.hostname,
|
||||||
|
exc,
|
||||||
|
)
|
||||||
|
logger.warning("SSH config fallback failed for %s (all transports)", self.hostname)
|
||||||
|
return ""
|
||||||
|
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
# NAPALM: get_environment
|
# NAPALM: get_environment
|
||||||
|
|||||||
Reference in New Issue
Block a user