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.
This commit is contained in:
Peter Sprygada 2018-03-03 17:26:28 -05:00 committed by Brian Coca
parent 4021194532
commit d1ff03e84c
2 changed files with 20 additions and 2 deletions

View file

@ -473,6 +473,15 @@ DEFAULT_CALLBACK_WHITELIST:
- {key: callback_whitelist, section: defaults} - {key: callback_whitelist, section: defaults}
type: list type: list
yaml: {key: plugins.callback.whitelist} 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: DEFAULT_CONNECTION_PLUGIN_PATH:
name: Connection Plugins Path name: Connection Plugins Path
default: ~/.ansible/plugins/connection:/usr/share/ansible/plugins/connection default: ~/.ansible/plugins/connection:/usr/share/ansible/plugins/connection
@ -800,6 +809,14 @@ DEFAULT_MODULE_UTILS_PATH:
ini: ini:
- {key: module_utils, section: defaults} - {key: module_utils, section: defaults}
type: pathspec 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: DEFAULT_NO_LOG:
name: No log name: No log
default: False default: False

View file

@ -60,6 +60,7 @@ class PluginLoader:
elif not config: elif not config:
config = [] config = []
import q; q(config)
self.config = config self.config = config
if class_name not in MODULE_CACHE: if class_name not in MODULE_CACHE:
@ -644,7 +645,7 @@ vars_loader = PluginLoader(
cliconf_loader = PluginLoader( cliconf_loader = PluginLoader(
'Cliconf', 'Cliconf',
'ansible.plugins.cliconf', 'ansible.plugins.cliconf',
'cliconf_plugins', C.DEFAULT_CLICONF_PLUGIN_PATH,
'cliconf_plugins', 'cliconf_plugins',
required_base_class='CliconfBase' required_base_class='CliconfBase'
) )
@ -652,7 +653,7 @@ cliconf_loader = PluginLoader(
netconf_loader = PluginLoader( netconf_loader = PluginLoader(
'Netconf', 'Netconf',
'ansible.plugins.netconf', 'ansible.plugins.netconf',
'netconf_plugins', C.DEFAULT_NETCONF_PLUGIN_PATH,
'netconf_plugins', 'netconf_plugins',
required_base_class='NetconfBase' required_base_class='NetconfBase'
) )