fix(get_config): try legacy KEX first in SSH fallback for HP 2530/Mocana SSH
This commit is contained in:
@@ -590,16 +590,25 @@ 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). 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.
|
||||
"""
|
||||
for legacy in (True, False):
|
||||
try:
|
||||
conn = ConnectHandler(**self._netmiko_kwargs())
|
||||
conn = ConnectHandler(**self._netmiko_kwargs(legacy=legacy))
|
||||
try:
|
||||
return conn.send_command("show running-config")
|
||||
finally:
|
||||
conn.disconnect()
|
||||
except Exception as exc:
|
||||
logger.warning("SSH config fallback failed for %s: %s", self.hostname, 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 ""
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user