mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Pull persistent connection parameters via get_option (#39367)
* WIP Pull persistent connection parameters via get_option * Fix pep8 * Add use_persistent_connection setting to paramiko_ssh plugin * Add vars section to persistent_command_timeout setting and prevail provider values over config manager * Use persistent_command_timeout on network_cli instead of timeout * Fix unit tests If we don't call loader to get network_cli, then _load_name is never set and we get KeyError. * Pull persistent_command_timeout via config manager for ios connection local * Pull persistent_command_timeout via config manager on connection local
This commit is contained in:
parent
865f2c5990
commit
62e1c14edc
12 changed files with 64 additions and 22 deletions
|
@ -31,6 +31,7 @@ from ansible.compat.tests.mock import patch, MagicMock
|
|||
from ansible.errors import AnsibleConnectionFailure
|
||||
from ansible.playbook.play_context import PlayContext
|
||||
from ansible.plugins.connection import network_cli
|
||||
from ansible.plugins.loader import connection_loader
|
||||
|
||||
|
||||
class TestConnectionClass(unittest.TestCase):
|
||||
|
@ -40,7 +41,7 @@ class TestConnectionClass(unittest.TestCase):
|
|||
pc = PlayContext()
|
||||
new_stdin = StringIO()
|
||||
|
||||
conn = network_cli.Connection(pc, new_stdin)
|
||||
conn = connection_loader.get('network_cli', pc, '/dev/null')
|
||||
conn.ssh = MagicMock()
|
||||
conn.receive = MagicMock()
|
||||
conn._terminal = MagicMock()
|
||||
|
@ -52,7 +53,7 @@ class TestConnectionClass(unittest.TestCase):
|
|||
pc = PlayContext()
|
||||
new_stdin = StringIO()
|
||||
|
||||
conn = network_cli.Connection(pc, new_stdin)
|
||||
conn = connection_loader.get('network_cli', pc, '/dev/null')
|
||||
conn.ssh = MagicMock()
|
||||
conn.receive = MagicMock()
|
||||
conn._terminal = MagicMock()
|
||||
|
@ -65,7 +66,7 @@ class TestConnectionClass(unittest.TestCase):
|
|||
pc = PlayContext()
|
||||
new_stdin = StringIO()
|
||||
|
||||
conn = network_cli.Connection(pc, new_stdin)
|
||||
conn = connection_loader.get('network_cli', pc, '/dev/null')
|
||||
pc.network_os = 'ios'
|
||||
|
||||
conn.ssh = MagicMock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue