From 38892e986ef78271a06b1d228a0d3294281c40d4 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 25 Mar 2015 13:56:46 -0700 Subject: [PATCH] Convert exceptions to unicode using to_unicode rather than str. that stops unicode errors if the string has non-ascii text --- v2/ansible/executor/task_executor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/v2/ansible/executor/task_executor.py b/v2/ansible/executor/task_executor.py index 7eaba0061ef..4ac06225139 100644 --- a/v2/ansible/executor/task_executor.py +++ b/v2/ansible/executor/task_executor.py @@ -26,6 +26,7 @@ from ansible.playbook.conditional import Conditional from ansible.playbook.task import Task from ansible.plugins import lookup_loader, connection_loader, action_loader from ansible.utils.listify import listify_lookup_plugin_terms +from ansible.utils.unicode import to_unicode from ansible.utils.debug import debug @@ -89,7 +90,7 @@ class TaskExecutor: debug("done dumping result, returning") return result except AnsibleError, e: - return dict(failed=True, msg=str(e)) + return dict(failed=True, msg=to_unicode(e, nonstring='simplerepr')) def _get_loop_items(self): '''