fix(config): read what retrieve asks in the REST-to-SSH fallback
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 25s
driver / types (pull_request) Successful in 1m15s
driver / test (3.12) (pull_request) Successful in 1m8s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / lowest (pull_request) Successful in 29s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m9s
CI / driver (pull_request) Successful in 2m54s
driver / publish (pull_request) Skipped
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 25s
driver / types (pull_request) Successful in 1m15s
driver / test (3.12) (pull_request) Successful in 1m8s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / lowest (pull_request) Successful in 29s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m9s
CI / driver (pull_request) Successful in 2m54s
driver / publish (pull_request) Skipped
A switch whose REST API has no configuration is read over a temporary SSH session. That path read the running config only, whatever retrieve asked for, and returned an empty startup config. It now reads through the same code as the SSH transport: running and/or startup as asked, "show config" where "show startup-config" is unknown, and a part that could not be read raises. Closes #25
This commit is contained in:
1 parent
f3da8944a3
commit
e0ff997d1b
6 files changed
+141
-29
No files matched your search
@@ -29,7 +29,7 @@ HANDLER = "napalm_procurve.procurve.ConnectHandler"
|
||||
|
||||
|
||||
def _device() -> MagicMock:
|
||||
device = MagicMock()
|
||||
device = MagicMock(base_prompt="sw1")
|
||||
device.remote_conn_pre.get_transport.return_value.get_remote_server_key.return_value = (
|
||||
SERVER_KEY
|
||||
)
|
||||
@@ -96,7 +96,7 @@ def test_the_config_fallback_checks_the_key_of_port_22():
|
||||
seen: list = []
|
||||
driver = _driver(seen, {"22": SshHostKey.of(SERVER_KEY).as_dict()}, port=443)
|
||||
with patch(HANDLER, return_value=_device()) as handler:
|
||||
assert driver._get_config_via_ssh() == "hostname x"
|
||||
assert driver._get_config_via_ssh()["running"] == "hostname x"
|
||||
assert handler.call_args.kwargs["port"] == 22
|
||||
assert handler.call_args.kwargs["ssh_strict"] is True
|
||||
assert seen[0]["port"] == 22 and seen[0]["accepted"] is True
|
||||
|
||||
Reference in new issue
Block a user