Fix network plugin config option load from collection (#64046)

* Fix network plugin config option load from collection

Fixes #63975

* Update the complete sub-plugin name within network
  connection plugins to handle sub-plugin in collection
  scenario.

* Fix review comments
This commit is contained in:
Ganesh Nalawade 2019-11-01 11:25:28 +05:30 committed by GitHub
parent 3f808d9ed6
commit 60276d3d8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View file

@ -201,8 +201,9 @@ class Connection(NetworkConnectionBase):
self.httpapi = httpapi_loader.get(self._network_os, self)
if self.httpapi:
self._sub_plugin = {'type': 'httpapi', 'name': self._network_os, 'obj': self.httpapi}
self.queue_message('vvvv', 'loaded API plugin for network_os %s' % self._network_os)
self._sub_plugin = {'type': 'httpapi', 'name': self.httpapi._load_name, 'obj': self.httpapi}
self.queue_message('vvvv', 'loaded API plugin %s from path %s for network_os %s' %
(self.httpapi._load_name, self.httpapi._original_path, self._network_os))
else:
raise AnsibleConnectionFailure('unable to load API plugin for network_os %s' % self._network_os)

View file

@ -228,8 +228,9 @@ class Connection(NetworkConnectionBase):
netconf = netconf_loader.get(self._network_os, self)
if netconf:
self._sub_plugin = {'type': 'netconf', 'name': self._network_os, 'obj': netconf}
self.queue_message('log', 'loaded netconf plugin for network_os %s' % self._network_os)
self._sub_plugin = {'type': 'netconf', 'name': netconf._load_name, 'obj': netconf}
self.queue_message('vvvv', 'loaded netconf plugin %s from path %s for network_os %s' %
(netconf._load_name, netconf._original_path, self._network_os))
else:
netconf = netconf_loader.get("default", self)
self._sub_plugin = {'type': 'netconf', 'name': 'default', 'obj': netconf}

View file

@ -329,8 +329,9 @@ class Connection(NetworkConnectionBase):
self.cliconf = cliconf_loader.get(self._network_os, self)
if self.cliconf:
self.queue_message('vvvv', 'loaded cliconf plugin for network_os %s' % self._network_os)
self._sub_plugin = {'type': 'cliconf', 'name': self._network_os, 'obj': self.cliconf}
self._sub_plugin = {'type': 'cliconf', 'name': self.cliconf._load_name, 'obj': self.cliconf}
self.queue_message('vvvv', 'loaded cliconf plugin %s from path %s for network_os %s' %
(self.cliconf._load_name, self.cliconf._original_path, self._network_os))
else:
self.queue_message('vvvv', 'unable to load cliconf for network_os %s' % self._network_os)
else: