From fca27c29f4f6bf8d89df8980dccc43b151262208 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Mon, 31 Aug 2015 16:45:03 -0400 Subject: [PATCH] Properly fail if slurp fails during fetch --- lib/ansible/plugins/action/fetch.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ansible/plugins/action/fetch.py b/lib/ansible/plugins/action/fetch.py index 297126c4131..71bf68defd9 100644 --- a/lib/ansible/plugins/action/fetch.py +++ b/lib/ansible/plugins/action/fetch.py @@ -61,7 +61,9 @@ class ActionModule(ActionBase): remote_data = None if remote_checksum in ('1', '2') or self._play_context.become: slurpres = self._execute_module(module_name='slurp', module_args=dict(src=source), task_vars=task_vars, tmp=tmp) - if not slurpres.get('failed', False): + if slurpres.get('failed'): + return slurpres + else: if slurpres['encoding'] == 'base64': remote_data = base64.b64decode(slurpres['content']) if remote_data is not None: @@ -72,9 +74,6 @@ class ActionModule(ActionBase): remote_source = slurpres.get('source') if remote_source and remote_source != source: source = remote_source - else: - # FIXME: should raise an error here? the old code did nothing - pass # calculate the destination name if os.path.sep not in self._connection._shell.join_path('a', ''):