adds support for using connection=netconf (#33400)

* adds support for using connection=netconf

This change updates the module to provide support for using
connection=netconf instead of connection=local.  If connection=netconf
is used, then the various connection arguments will be silently ignored.

* adds netconf plugin default

This adds a default implementation for netconf plugins if the network_os
is not specified.  The default plugin will implement only the standard
netconf rpcs

* fix up pep8 issues
This commit is contained in:
Peter Sprygada 2018-01-24 11:18:41 -05:00 committed by Ganesh Nalawade
parent bd09e67438
commit b4fa68555d
4 changed files with 151 additions and 60 deletions

View file

@ -238,8 +238,7 @@ class Connection(ConnectionBase):
if network_os:
display.display('discovered network_os %s' % network_os, log_only=True)
if not network_os:
raise AnsibleConnectionFailure('Unable to automatically determine host network os. Please ansible_network_os value')
device_params = {'name': (network_os or 'default')}
ssh_config = os.getenv('ANSIBLE_NETCONF_SSH_CONFIG', False)
if ssh_config in BOOLEANS_TRUE:
@ -256,9 +255,9 @@ class Connection(ConnectionBase):
key_filename=str(key_filename),
hostkey_verify=C.HOST_KEY_CHECKING,
look_for_keys=C.PARAMIKO_LOOK_FOR_KEYS,
device_params=device_params,
allow_agent=self._play_context.allow_agent,
timeout=self._play_context.timeout,
device_params={'name': network_os},
ssh_config=ssh_config
)
except SSHUnknownHostError as exc: