From ebf835045f0fd54c8b6d416f0dc859b556ae9e07 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 20 Dec 2016 15:25:37 -0500 Subject: [PATCH] unique error messages to avoid confusion --- lib/ansible/module_utils/basic.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 385eaaa377..ee134f0e3e 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -2051,8 +2051,7 @@ class AnsibleModule(object): native_suffix = os.path.basename(b_dest) native_prefix = b('.ansible_tmp') try: - tmp_dest_fd, tmp_dest_name = tempfile.mkstemp( - prefix=native_prefix, dir=native_dest_dir, suffix=native_suffix) + tmp_dest_fd, tmp_dest_name = tempfile.mkstemp( prefix=native_prefix, dir=native_dest_dir, suffix=native_suffix) except (OSError, IOError): e = get_exception() self.fail_json(msg='The destination directory (%s) is not writable by the current user. Error was: %s' % (os.path.dirname(dest), e)) @@ -2095,10 +2094,10 @@ class AnsibleModule(object): if unsafe_writes: self._unsafe_writes(b_tmp_dest_name, b_dest, e) else: - self.fail_json(msg='Could not replace file: %s to %s: %s' % (src, dest, e)) + self.fail_json(msg='Unable to rename file: %s to %s: %s' % (src, dest, e)) except (shutil.Error, OSError, IOError): e = get_exception() - self.fail_json(msg='Could not replace file: %s to %s: %s' % (src, dest, e)) + self.fail_json(msg='Failed to replace file: %s to %s: %s' % (src, dest, e)) finally: self.cleanup(b_tmp_dest_name)