check for failure in fact gathering

pull/11969/merge
Brian Coca 9 years ago
parent 1edae51e05
commit 7a51836530

@ -40,8 +40,8 @@ class ActionModule(ActionBase):
if module == 'auto': if module == 'auto':
facts = self._execute_module(module_name='setup', module_args=dict(filter='ansible_pkg_mgr'), task_vars=task_vars) facts = self._execute_module(module_name='setup', module_args=dict(filter='ansible_pkg_mgr'), task_vars=task_vars)
self._display.degug("Facts %s" % facts) 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': if module != 'auto':
# run the 'package' module # run the 'package' module

@ -40,7 +40,8 @@ class ActionModule(ActionBase):
if module == 'auto': if module == 'auto':
facts = self._execute_module(module_name='setup', module_args=dict(filter='ansible_service_mgr'), task_vars=task_vars) facts = self._execute_module(module_name='setup', module_args=dict(filter='ansible_service_mgr'), task_vars=task_vars)
self._display.debug("Facts %s" % facts) 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': if not module or module == 'auto':
module = 'service' module = 'service'

Loading…
Cancel
Save