mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Plug-ins loaded from top-level plug-in directory
PluginLoader._get_paths, as of 391fb98e, was only finding plug-ins that
were in a subdirectory of one of the basedirs (i.e. in a category
directory). For example, action_plugins/foo.py would never be loaded,
but action_plugins/bar/foo.py would work.
This makes it so that "uncategorized" plug-ins in the top level of a
directory such as action_plugins will be loaded, though plug-ins in a
"category" subdirectory will still be preferred. For example,
action_plugins/bar/foo.py would be preferred over action_plugins/foo.py.
This commit is contained in:
@@ -27,6 +27,7 @@ class TestRunner(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.user = getpass.getuser()
|
||||
self.runner = ansible.runner.Runner(
|
||||
basedir='test/',
|
||||
module_name='ping',
|
||||
module_path='library/',
|
||||
module_args='',
|
||||
@@ -77,6 +78,12 @@ class TestRunner(unittest.TestCase):
|
||||
assert "localhost" in results['contacted']
|
||||
return results['contacted']['localhost']
|
||||
|
||||
def test_action_plugins(self):
|
||||
result = self._run("uncategorized_plugin", [])
|
||||
assert result.get("msg") == "uncategorized"
|
||||
result = self._run("categorized_plugin", [])
|
||||
assert result.get("msg") == "categorized"
|
||||
|
||||
def test_ping(self):
|
||||
result = self._run('ping', [])
|
||||
assert "ping" in result
|
||||
|
||||
Reference in New Issue
Block a user