summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2015-02-02 13:37:31 -0800
committerJames Cammarata <jimi@sngx.net>2015-02-17 14:03:34 -0600
commitad6183a322e00f7b9d751cd02d608b804ef79a91 (patch)
treeaf19c4d0e90c3ea82d9edbdd87e2082ba06d5275
parentb160026fea49e04b05b225a63246d1543cb4684d (diff)
downloadansible-ad6183a322e00f7b9d751cd02d608b804ef79a91.tar.gz
Be explicit about unicode str transformation
Fixes #10126
-rw-r--r--lib/ansible/callbacks.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/ansible/callbacks.py b/lib/ansible/callbacks.py
index a84dd75e70..5434885971 100644
--- a/lib/ansible/callbacks.py
+++ b/lib/ansible/callbacks.py
@@ -629,7 +629,13 @@ class PlaybookCallbacks(object):
if hasattr(self, 'start_at'): # we still have start_at so skip the task
self.skip_task = True
elif hasattr(self, 'step') and self.step:
- msg = ('Perform task: %s (y/n/c): ' % name).encode(sys.stdout.encoding)
+ if isinstance(name, str):
+ name = utils.to_unicode(name)
+ msg = u'Perform task: %s (y/n/c): ' % name
+ if sys.stdout.encoding:
+ msg = msg.encode(sys.stdout.encoding, errors='replace')
+ else:
+ msg = msg.encode('utf-8')
resp = raw_input(msg)
if resp.lower() in ['y','yes']:
self.skip_task = False