From 60276d3d8da8496e45a5c320113b5a8d7deaeb3d Mon Sep 17 00:00:00 2001 From: Ganesh Nalawade Date: Fri, 1 Nov 2019 11:25:28 +0530 Subject: [PATCH] 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 --- lib/ansible/plugins/connection/httpapi.py | 5 +++-- lib/ansible/plugins/connection/netconf.py | 5 +++-- lib/ansible/plugins/connection/network_cli.py | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/ansible/plugins/connection/httpapi.py b/lib/ansible/plugins/connection/httpapi.py index 37facee8f1c..abe88d9a539 100644 --- a/lib/ansible/plugins/connection/httpapi.py +++ b/lib/ansible/plugins/connection/httpapi.py @@ -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) diff --git a/lib/ansible/plugins/connection/netconf.py b/lib/ansible/plugins/connection/netconf.py index ac6c8c3b57b..47d5e12ee2b 100644 --- a/lib/ansible/plugins/connection/netconf.py +++ b/lib/ansible/plugins/connection/netconf.py @@ -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} diff --git a/lib/ansible/plugins/connection/network_cli.py b/lib/ansible/plugins/connection/network_cli.py index cd812a2e9bc..d188da3293f 100644 --- a/lib/ansible/plugins/connection/network_cli.py +++ b/lib/ansible/plugins/connection/network_cli.py @@ -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: