From d1ff03e84cfc6db2b0b3c13cff086c1e74afdbe9 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Sat, 3 Mar 2018 17:26:28 -0500 Subject: [PATCH] fixes cliconf and netconf plugin loaders This change updates the configuration and plugin loader objects for cliconf and netconf to pull be able to configure where to find the plugins. --- lib/ansible/config/base.yml | 17 +++++++++++++++++ lib/ansible/plugins/loader.py | 5 +++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index 7a70f03d2b0..b8d7f869fa1 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -473,6 +473,15 @@ DEFAULT_CALLBACK_WHITELIST: - {key: callback_whitelist, section: defaults} type: list yaml: {key: plugins.callback.whitelist} +DEFAULT_CLICONF_PLUGIN_PATH: + name: Cliconf Plugins Path + default: ~/.ansible/plugins/cliconf:/usr/share/ansible/plugins/cliconf + description: Colon separated paths in which Ansible will search for Cliconf Plugins. + env: [{name: ANSIBLE_CLICONF_PLUGINS}] + ini: + - {key: cliconf_plugins, section: defaults} + type: pathspec + yaml: {key: plugins.connection.path} DEFAULT_CONNECTION_PLUGIN_PATH: name: Connection Plugins Path default: ~/.ansible/plugins/connection:/usr/share/ansible/plugins/connection @@ -800,6 +809,14 @@ DEFAULT_MODULE_UTILS_PATH: ini: - {key: module_utils, section: defaults} type: pathspec +DEFAULT_NETCONF_PLUGIN_PATH: + name: Netconf Plugins Path + default: ~/.ansible/plugins/netconf:/usr/share/ansible/plugins/netconf + description: Colon separated paths in which Ansible will search for Netconf Plugins. + env: [{name: ANSIBLE_NETCONF_PLUGINS}] + ini: + - {key: cliconf_plugins, section: defaults} + type: pathspec DEFAULT_NO_LOG: name: No log default: False diff --git a/lib/ansible/plugins/loader.py b/lib/ansible/plugins/loader.py index 43a65645621..686f87f4119 100644 --- a/lib/ansible/plugins/loader.py +++ b/lib/ansible/plugins/loader.py @@ -60,6 +60,7 @@ class PluginLoader: elif not config: config = [] + import q; q(config) self.config = config if class_name not in MODULE_CACHE: @@ -644,7 +645,7 @@ vars_loader = PluginLoader( cliconf_loader = PluginLoader( 'Cliconf', 'ansible.plugins.cliconf', - 'cliconf_plugins', + C.DEFAULT_CLICONF_PLUGIN_PATH, 'cliconf_plugins', required_base_class='CliconfBase' ) @@ -652,7 +653,7 @@ cliconf_loader = PluginLoader( netconf_loader = PluginLoader( 'Netconf', 'ansible.plugins.netconf', - 'netconf_plugins', + C.DEFAULT_NETCONF_PLUGIN_PATH, 'netconf_plugins', required_base_class='NetconfBase' )