From 7a51836530b811eb6c5442b91dec77c9cb8c59e6 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Sat, 15 Aug 2015 11:29:10 -0400 Subject: [PATCH] check for failure in fact gathering --- lib/ansible/plugins/action/package.py | 4 ++-- lib/ansible/plugins/action/service.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/plugins/action/package.py b/lib/ansible/plugins/action/package.py index dce7165629..9488b9f108 100644 --- a/lib/ansible/plugins/action/package.py +++ b/lib/ansible/plugins/action/package.py @@ -40,8 +40,8 @@ class ActionModule(ActionBase): if module == 'auto': facts = self._execute_module(module_name='setup', module_args=dict(filter='ansible_pkg_mgr'), task_vars=task_vars) self._display.degug("Facts %s" % facts) - module = getattr(facts['ansible_facts'], 'ansible_pkg_mgr', 'auto') - + if not 'failed' in facts: + module = getattr(facts['ansible_facts'], 'ansible_pkg_mgr', 'auto') if module != 'auto': # run the 'package' module diff --git a/lib/ansible/plugins/action/service.py b/lib/ansible/plugins/action/service.py index 98c4695106..fc1704c386 100644 --- a/lib/ansible/plugins/action/service.py +++ b/lib/ansible/plugins/action/service.py @@ -40,7 +40,8 @@ class ActionModule(ActionBase): if module == 'auto': facts = self._execute_module(module_name='setup', module_args=dict(filter='ansible_service_mgr'), task_vars=task_vars) self._display.debug("Facts %s" % facts) - module = getattr(facts['ansible_facts'], 'ansible_service_mgr', 'auto') + if not 'failed' in facts: + module = getattr(facts['ansible_facts'], 'ansible_service_mgr', 'auto') if not module or module == 'auto': module = 'service'