Remove plugin._basedirs as we now use different data structures to achieve that functionality.

pull/12319/head
Toshio Kuratomi 9 years ago
parent e6c9efec63
commit 46bf3d1bc1

@ -40,18 +40,6 @@ except ImportError:
MODULE_CACHE = {} MODULE_CACHE = {}
PATH_CACHE = {} PATH_CACHE = {}
PLUGIN_PATH_CACHE = {} PLUGIN_PATH_CACHE = {}
_basedirs = []
# FIXME: the _basedirs code may be dead, and no longer needed, as
# we now use add_directory for all plugin types here instead
# of relying on this global variable (which also causes problems
# with forked processes). See the Playbook() and Role() classes
# for how we now ue get_all_plugin_loaders() below.
def push_basedir(basedir):
# avoid pushing the same absolute dir more than once
basedir = to_unicode(os.path.realpath(basedir))
if basedir not in _basedirs:
_basedirs.insert(0, basedir)
def get_all_plugin_loaders(): def get_all_plugin_loaders():
return [(name, obj) for (name, obj) in inspect.getmembers(sys.modules[__name__]) if isinstance(obj, PluginLoader)] return [(name, obj) for (name, obj) in inspect.getmembers(sys.modules[__name__]) if isinstance(obj, PluginLoader)]
@ -165,22 +153,6 @@ class PluginLoader:
return self._paths return self._paths
ret = self._extra_dirs[:] ret = self._extra_dirs[:]
for basedir in _basedirs:
fullpath = os.path.realpath(os.path.join(basedir, self.subdir))
if os.path.isdir(fullpath):
files = glob.glob("%s/*" % fullpath)
# allow directories to be two levels deep
files2 = glob.glob("%s/*/*" % fullpath)
if files2 is not None:
files.extend(files2)
for file in files:
if os.path.isdir(file) and file not in ret:
ret.append(file)
if fullpath not in ret:
ret.append(fullpath)
# look in any configured plugin paths, allow one level deep for subcategories # look in any configured plugin paths, allow one level deep for subcategories
if self.config is not None: if self.config is not None:

@ -33,7 +33,7 @@ from ansible.playbook.handler import Handler
from ansible.playbook.helpers import load_list_of_blocks from ansible.playbook.helpers import load_list_of_blocks
from ansible.playbook.included_file import IncludedFile from ansible.playbook.included_file import IncludedFile
from ansible.playbook.role import hash_params from ansible.playbook.role import hash_params
from ansible.plugins import _basedirs, action_loader, connection_loader, filter_loader, lookup_loader, module_loader from ansible.plugins import action_loader, connection_loader, filter_loader, lookup_loader, module_loader
from ansible.template import Templar from ansible.template import Templar
try: try:
@ -53,7 +53,6 @@ class SharedPluginLoaderObj:
the forked processes over the queue easier the forked processes over the queue easier
''' '''
def __init__(self): def __init__(self):
self.basedirs = _basedirs[:]
self.action_loader = action_loader self.action_loader = action_loader
self.connection_loader = connection_loader self.connection_loader = connection_loader
self.filter_loader = filter_loader self.filter_loader = filter_loader

@ -31,7 +31,7 @@ from jinja2.runtime import StrictUndefined
from ansible import constants as C from ansible import constants as C
from ansible.errors import AnsibleError, AnsibleFilterError, AnsibleUndefinedVariable from ansible.errors import AnsibleError, AnsibleFilterError, AnsibleUndefinedVariable
from ansible.plugins import _basedirs, filter_loader, lookup_loader, test_loader from ansible.plugins import filter_loader, lookup_loader, test_loader
from ansible.template.safe_eval import safe_eval from ansible.template.safe_eval import safe_eval
from ansible.template.template import AnsibleJ2Template from ansible.template.template import AnsibleJ2Template
from ansible.template.vars import AnsibleJ2Vars from ansible.template.vars import AnsibleJ2Vars

Loading…
Cancel
Save