From c622cc65091c5877047a5836b67f6204d96e9e84 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 19 Jul 2018 12:13:09 -0400 Subject: [PATCH] better error messasge (#42770) * better error messasge (cherry picked from commit 9217fbb7dde50de23b5fb6f7aebfe44f3a394d33) --- changelogs/fragments/clarify_error_message.yml | 2 ++ lib/ansible/module_utils/basic.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/clarify_error_message.yml diff --git a/changelogs/fragments/clarify_error_message.yml b/changelogs/fragments/clarify_error_message.yml new file mode 100644 index 00000000000..bebcc0873a9 --- /dev/null +++ b/changelogs/fragments/clarify_error_message.yml @@ -0,0 +1,2 @@ +bugfixes: + - Fix an atomic_move error that is 'true', but misleading. Now we show all 3 files involved and clarify what happened. diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 65adce93194..5f8f1d9a79e 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -2605,7 +2605,8 @@ class AnsibleModule(object): if unsafe_writes and e.errno == errno.EBUSY: self._unsafe_writes(b_tmp_dest_name, b_dest) else: - self.fail_json(msg='Unable to rename file: %s to %s: %s' % (src, dest, to_native(e)), + self.fail_json(msg='Unable to make %s into to %s, failed final rename from %s: %s' % + (src, dest, b_tmp_dest_name, to_native(e)), exception=traceback.format_exc()) except (shutil.Error, OSError, IOError) as e: self.fail_json(msg='Failed to replace file: %s to %s: %s' % (src, dest, to_native(e)),