|
|
@ -31,6 +31,7 @@ import warnings
|
|
|
|
from collections import defaultdict
|
|
|
|
from collections import defaultdict
|
|
|
|
|
|
|
|
|
|
|
|
from ansible import constants as C
|
|
|
|
from ansible import constants as C
|
|
|
|
|
|
|
|
from ansible.utils.unicode import to_str
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
from __main__ import display
|
|
|
|
from __main__ import display
|
|
|
@ -247,7 +248,7 @@ class PluginLoader:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
full_paths = (os.path.join(path, f) for f in os.listdir(path))
|
|
|
|
full_paths = (os.path.join(path, f) for f in os.listdir(path))
|
|
|
|
except OSError as e:
|
|
|
|
except OSError as e:
|
|
|
|
display.warning("Error accessing plugin paths: %s" % str(e))
|
|
|
|
display.warning("Error accessing plugin paths: %s" % to_str(e))
|
|
|
|
|
|
|
|
|
|
|
|
for full_path in (f for f in full_paths if os.path.isfile(f) and not f.endswith('__init__.py')):
|
|
|
|
for full_path in (f for f in full_paths if os.path.isfile(f) and not f.endswith('__init__.py')):
|
|
|
|
full_name = os.path.basename(full_path)
|
|
|
|
full_name = os.path.basename(full_path)
|
|
|
@ -366,7 +367,11 @@ class PluginLoader:
|
|
|
|
if path not in self._module_cache:
|
|
|
|
if path not in self._module_cache:
|
|
|
|
self._module_cache[path] = self._load_module_source(name, path)
|
|
|
|
self._module_cache[path] = self._load_module_source(name, path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
obj = getattr(self._module_cache[path], self.class_name)
|
|
|
|
obj = getattr(self._module_cache[path], self.class_name)
|
|
|
|
|
|
|
|
except AttributeError as e:
|
|
|
|
|
|
|
|
display.warning("Skipping plugin (%s) as it seems to be invalid: %s" % (path, to_str(e)))
|
|
|
|
|
|
|
|
|
|
|
|
if self.base_class:
|
|
|
|
if self.base_class:
|
|
|
|
# The import path is hardcoded and should be the right place,
|
|
|
|
# The import path is hardcoded and should be the right place,
|
|
|
|
# so we are not expecting an ImportError.
|
|
|
|
# so we are not expecting an ImportError.
|
|
|
|