Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove connection_timeout from Netmiko args #62548

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/62547.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove the connection_timeout from netmiko_connection_args before netmiko_connection_args is added to __context__["netmiko_device"]["args"] which is passed along to the Netmiko library.
1 change: 1 addition & 0 deletions salt/proxy/netmiko_px.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def init(opts):
netmiko_connection_args.pop("proxytype", None)
netmiko_connection_args.pop("multiprocessing", None)
netmiko_connection_args.pop("skip_connect_on_init", None)
netmiko_connection_args.pop("connection_timeout", None)

__context__["netmiko_device"]["args"] = netmiko_connection_args

Expand Down
18 changes: 18 additions & 0 deletions tests/pytests/unit/proxy/test_netmiko_px.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,24 @@ def test_init_skip_connect_on_init_false(proxy_minion_config):
assert "connection" in netmiko_device


def test_init_connection_timeout(proxy_minion_config):
"""
check that connection_timeout is removed from args
before being passed along.
"""

proxy_minion_config["connection_timeout"] = 60

mock_make_con = MagicMock()
with patch.object(netmiko_proxy, "make_con", mock_make_con):
assert netmiko_proxy.init(proxy_minion_config) is None

assert "netmiko_device" in netmiko_proxy.__context__
netmiko_device = netmiko_proxy.__context__["netmiko_device"]
assert "args" in netmiko_device
assert "connection_timeout" not in netmiko_device["args"]


def test_make_con(proxy_minion_config):
"""
check netmiko_proxy make_con method
Expand Down