diff options
author | Brian Coca <brian.coca+git@gmail.com> | 2015-08-31 13:25:07 -0400 |
---|---|---|
committer | Brian Coca <brian.coca+git@gmail.com> | 2015-08-31 20:34:20 -0400 |
commit | 74583315395fbbbb6c123bc86cc4f3fb390d5201 (patch) | |
tree | 9541349c995d7d3a3fbfd463331674d4f2e1b116 | |
parent | bca4e23b2789f7904eb602338eaa0e2080f389dc (diff) | |
download | ansible-74583315395fbbbb6c123bc86cc4f3fb390d5201.tar.gz |
package and service now check that module exists before trying to execute it
-rw-r--r-- | lib/ansible/plugins/action/package.py | 4 | ||||
-rw-r--r-- | lib/ansible/plugins/action/service.py | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/ansible/plugins/action/package.py b/lib/ansible/plugins/action/package.py index 9488b9f108..024ef790ab 100644 --- a/lib/ansible/plugins/action/package.py +++ b/lib/ansible/plugins/action/package.py @@ -44,6 +44,10 @@ class ActionModule(ActionBase): module = getattr(facts['ansible_facts'], 'ansible_pkg_mgr', 'auto') if module != 'auto': + + if module not in self._shared_loader_obj.module_loader: + return {'failed': True, 'msg': 'Could not find a module for %s.' % module} + # run the 'package' module new_module_args = self._task.args.copy() if 'use' in new_module_args: diff --git a/lib/ansible/plugins/action/service.py b/lib/ansible/plugins/action/service.py index fc1704c386..8cceb85e94 100644 --- a/lib/ansible/plugins/action/service.py +++ b/lib/ansible/plugins/action/service.py @@ -20,6 +20,7 @@ __metaclass__ = type from ansible.plugins.action import ActionBase + class ActionModule(ActionBase): TRANSFERS_FILES = False @@ -43,7 +44,7 @@ class ActionModule(ActionBase): if not 'failed' in facts: module = getattr(facts['ansible_facts'], 'ansible_service_mgr', 'auto') - if not module or module == 'auto': + if not module or module == 'auto' or module not in self._shared_loader_obj.module_loader: module = 'service' if module != 'auto': |