diff --git a/lib/ansible/modules/network/basics/uri.py b/lib/ansible/modules/network/basics/uri.py index 377d50a0ce5..cb1faf6ecb2 100644 --- a/lib/ansible/modules/network/basics/uri.py +++ b/lib/ansible/modules/network/basics/uri.py @@ -425,15 +425,14 @@ def main(): # and the filename already exists. This allows idempotence # of uri executions. if os.path.exists(creates): - module.exit_json(stdout="skipped, since %s exists" % creates, - changed=False, stderr=False, rc=0) + module.exit_json(stdout="skipped, since %s exists" % creates, changed=False, rc=0) if removes is not None: # do not run the command if the line contains removes=filename # and the filename do not exists. This allows idempotence # of uri executions. if not os.path.exists(removes): - module.exit_json(stdout="skipped, since %s does not exist" % removes, changed=False, stderr=False, rc=0) + module.exit_json(stdout="skipped, since %s does not exist" % removes, changed=False, rc=0) # Make the request resp, content, dest = uri(module, url, dest, body, body_format, method, diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index 95343c2e696..987f49b05e1 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -514,7 +514,7 @@ class ActionBase(with_metaclass(ABCMeta, object)): 3 = its a directory, not a file 4 = stat module failed, likely due to not finding python ''' - x = "0" # unknown error has occured + x = "0" # unknown error has occurred try: remote_stat = self._execute_remote_stat(path, all_vars, follow=follow) if remote_stat['exists'] and remote_stat['isdir']: @@ -754,9 +754,13 @@ class ActionBase(with_metaclass(ABCMeta, object)): # pre-split stdout/stderr into lines if needed if 'stdout' in data and 'stdout_lines' not in data: - data['stdout_lines'] = data.get('stdout', u'').splitlines() + # if the value is 'False', a default won't catch it. + txt = data.get('stdout', None) or u'' + data['stdout_lines'] = txt.splitlines() if 'stderr' in data and 'stderr_lines' not in data: - data['stderr_lines'] = data.get('stderr', u'').splitlines() + # if the value is 'False', a default won't catch it. + txt = data.get('stderr', None) or u'' + data['stderr_lines'] = txt.splitlines() display.debug("done with _execute_module (%s, %s)" % (module_name, module_args)) return data