From 6a0a36674695b7ef1337d82c493fa60d24482204 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 26 May 2016 13:37:59 -0400 Subject: [PATCH] fixed service fact usage --- lib/ansible/plugins/action/service.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/plugins/action/service.py b/lib/ansible/plugins/action/service.py index 54a5a6094cf..8a0cfd21ea7 100644 --- a/lib/ansible/plugins/action/service.py +++ b/lib/ansible/plugins/action/service.py @@ -32,7 +32,7 @@ class ActionModule(ActionBase): result = super(ActionModule, self).run(tmp, task_vars) - module = self._task.args.get('use', 'auto') + module = self._task.args.get('use', 'auto').lower() if module == 'auto': try: @@ -43,8 +43,8 @@ class ActionModule(ActionBase): if module == 'auto': facts = self._execute_module(module_name='setup', module_args=dict(gather_subset='!all', filter='ansible_service_mgr'), task_vars=task_vars) self._display.debug("Facts %s" % facts) - if 'failed' not in facts: - module = getattr(facts['ansible_facts'], 'ansible_service_mgr', 'auto') + if 'ansible_facts' in facts and 'ansible_service_mgr' in facts['ansible_facts']: + module = facts['ansible_facts']['ansible_service_mgr'] if not module or module == 'auto' or module not in self._shared_loader_obj.module_loader: module = 'service'