mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
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.
This commit is contained in:
parent
7ab9b06b1b
commit
3f917db36f
2 changed files with 19 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue