summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Scherer <misc@zarb.org>2016-10-26 18:22:54 +0200
committerJames Cammarata <jimi@sngx.net>2017-07-25 14:05:10 -0500
commit3e0c220fb956d2546d61b33b08c43d3e5bdfedf2 (patch)
tree1778091df7df9a517caec955c3059b87b11a0723
parent197a360977a52a31d6ab40db1f4752454e8b93e3 (diff)
downloadansible-mscherer-support_action_plugin.tar.gz
Permit to have a action plugin without a empty module filemscherer-support_action_plugin
Currently, someone writing a action plugin will also need to have a empty file in the module path to avoid triggering the error "no action detected in task.".
-rw-r--r--lib/ansible/cli/doc.py4
-rw-r--r--lib/ansible/parsing/mod_args.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/ansible/cli/doc.py b/lib/ansible/cli/doc.py
index 7f9ba3f2f6..99a275e697 100644
--- a/lib/ansible/cli/doc.py
+++ b/lib/ansible/cli/doc.py
@@ -124,6 +124,8 @@ class DocCLI(CLI):
try:
# if the plugin lives in a non-python file (eg, win_X.ps1), require the corresponding python file for docs
filename = loader.find_plugin(plugin, mod_type='.py', ignore_deprecated=True)
+ if filename is None and loader == module_loader:
+ filename = action_loader.find_plugin(module, mod_type='.py')
if filename is None:
display.warning("%s %s not found in %s\n" % (plugin_type, plugin, DocCLI.print_paths(loader)))
continue
@@ -217,6 +219,8 @@ class DocCLI(CLI):
# if the module lives in a non-python file (eg, win_X.ps1), require the corresponding python file for docs
filename = loader.find_plugin(plugin, mod_type='.py', ignore_deprecated=True)
+ if filename is None and loader == module_loader:
+ filename = action_loader.find_plugin(module, mod_type='.py')
if filename is None:
continue
if filename.endswith(".ps1"):
diff --git a/lib/ansible/parsing/mod_args.py b/lib/ansible/parsing/mod_args.py
index ba47dd27b4..39d9ff25dc 100644
--- a/lib/ansible/parsing/mod_args.py
+++ b/lib/ansible/parsing/mod_args.py
@@ -23,7 +23,7 @@ from ansible.errors import AnsibleParserError, AnsibleError
from ansible.module_utils.six import iteritems, string_types
from ansible.module_utils._text import to_text
from ansible.parsing.splitter import parse_kv, split_args
-from ansible.plugins import module_loader
+from ansible.plugins import module_loader, action_loader
from ansible.template import Templar
@@ -286,7 +286,7 @@ class ModuleArgsParser:
# walk the input dictionary to see we recognize a module name
for (item, value) in iteritems(self._task_ds):
- if item in module_loader or item in ['meta', 'include', 'include_tasks', 'include_role', 'import_tasks', 'import_role']:
+ if item in module_loader or item in action_loader or item in ['meta', 'include', 'include_tasks', 'include_role', 'import_tasks', 'import_role']:
# finding more than one module name is a problem
if action is not None:
raise AnsibleParserError("conflicting action statements: %s, %s" % (action, item), obj=self._task_ds)