From 3965689328a97471afd21a3cdeabdd7c56d83a42 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 19 Apr 2017 11:35:25 -0400 Subject: [PATCH] finer grained failed/skipped on async for actions fixes #23729 --- lib/ansible/plugins/action/__init__.py | 8 ++++---- lib/ansible/plugins/action/add_host.py | 2 +- lib/ansible/plugins/action/assemble.py | 2 +- lib/ansible/plugins/action/copy.py | 2 +- lib/ansible/plugins/action/package.py | 2 +- lib/ansible/plugins/action/service.py | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index 12889feb41..c56db2ff31 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -90,17 +90,17 @@ class ActionBase(with_metaclass(ABCMeta, object)): * Module parameters. These are stored in self._task.args """ - result = {'skipped': True} + result = {} if self._task.async and not self._supports_async: result['msg'] = 'async is not supported for this task.' + result['failed'] = True elif self._play_context.check_mode and not self._supports_check_mode: result['msg'] = 'check mode is not supported for this task.' + result['skipped'] = True elif self._task.async and self._play_context.check_mode: result['msg'] = 'check mode and async cannot be used on same task.' - else: - # we run! - del result['skipped'] + result['failed'] = True return result diff --git a/lib/ansible/plugins/action/add_host.py b/lib/ansible/plugins/action/add_host.py index 9b46e5dd28..bc2d94f9f5 100644 --- a/lib/ansible/plugins/action/add_host.py +++ b/lib/ansible/plugins/action/add_host.py @@ -45,7 +45,7 @@ class ActionModule(ActionBase): result = super(ActionModule, self).run(tmp, task_vars) - if result.get('skipped', False): + if result.get('skipped', False) or result.get('failed', False): return result # Parse out any hostname:port patterns diff --git a/lib/ansible/plugins/action/assemble.py b/lib/ansible/plugins/action/assemble.py index de22b06a18..70211d6203 100644 --- a/lib/ansible/plugins/action/assemble.py +++ b/lib/ansible/plugins/action/assemble.py @@ -84,7 +84,7 @@ class ActionModule(ActionBase): result = super(ActionModule, self).run(tmp, task_vars) - if result.get('skipped', False): + if result.get('skipped', False) or result.get('failed', False): return result if task_vars is None: diff --git a/lib/ansible/plugins/action/copy.py b/lib/ansible/plugins/action/copy.py index 3745933b08..4be4b36e53 100644 --- a/lib/ansible/plugins/action/copy.py +++ b/lib/ansible/plugins/action/copy.py @@ -40,7 +40,7 @@ class ActionModule(ActionBase): result = super(ActionModule, self).run(tmp, task_vars) - if result.get('skipped'): + if result.get('skipped', False) or result.get('failed', False): return result source = self._task.args.get('src', None) diff --git a/lib/ansible/plugins/action/package.py b/lib/ansible/plugins/action/package.py index c93fa311c1..cd6d3851f0 100644 --- a/lib/ansible/plugins/action/package.py +++ b/lib/ansible/plugins/action/package.py @@ -38,7 +38,7 @@ class ActionModule(ActionBase): result = super(ActionModule, self).run(tmp, task_vars) - if result.get('skipped', False): + if result.get('skipped', False) or result.get('failed', False): return result module = self._task.args.get('use', 'auto') diff --git a/lib/ansible/plugins/action/service.py b/lib/ansible/plugins/action/service.py index 37539d6cea..07e9dde81b 100644 --- a/lib/ansible/plugins/action/service.py +++ b/lib/ansible/plugins/action/service.py @@ -37,7 +37,7 @@ class ActionModule(ActionBase): result = super(ActionModule, self).run(tmp, task_vars) - if result.get('skipped', False): + if result.get('skipped', False) or result.get('failed', False): return result module = self._task.args.get('use', 'auto').lower()