From 203630f47e6d06e5575a9e3bb4db76cb12ead936 Mon Sep 17 00:00:00 2001
From: Russell Teague <rteague@redhat.com>
Date: Fri, 31 Mar 2017 15:03:39 -0400
Subject: Support unicode output when dumping yaml

---
 utils/src/ooinstall/ansible_plugins/facts_callback.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

(limited to 'utils')

diff --git a/utils/src/ooinstall/ansible_plugins/facts_callback.py b/utils/src/ooinstall/ansible_plugins/facts_callback.py
index c881e4b92..433e29dde 100644
--- a/utils/src/ooinstall/ansible_plugins/facts_callback.py
+++ b/utils/src/ooinstall/ansible_plugins/facts_callback.py
@@ -7,6 +7,12 @@ import yaml
 from ansible.plugins.callback import CallbackBase
 from ansible.parsing.yaml.dumper import AnsibleDumper
 
+# ansible.compat.six goes away with Ansible 2.4
+try:
+    from ansible.compat.six import u
+except ImportError:
+    from ansible.module_utils.six import u
+
 
 # pylint: disable=super-init-not-called
 class CallbackModule(CallbackBase):
@@ -39,10 +45,10 @@ class CallbackModule(CallbackBase):
             facts = abridged_result['result']['ansible_facts']['openshift']
             hosts_yaml = {}
             hosts_yaml[res._host.get_name()] = facts
-            to_dump = yaml.dump(hosts_yaml,
-                                allow_unicode=True,
-                                default_flow_style=False,
-                                Dumper=AnsibleDumper)
+            to_dump = u(yaml.dump(hosts_yaml,
+                                  allow_unicode=True,
+                                  default_flow_style=False,
+                                  Dumper=AnsibleDumper))
             os.write(self.hosts_yaml, to_dump)
 
     def v2_runner_on_skipped(self, res):
-- 
cgit v1.2.3