diff options
author | Russell Teague <rteague@redhat.com> | 2017-03-31 15:03:39 -0400 |
---|---|---|
committer | Russell Teague <rteague@redhat.com> | 2017-04-03 14:39:35 -0400 |
commit | 203630f47e6d06e5575a9e3bb4db76cb12ead936 (patch) | |
tree | 8434ddd592d812ac0f70141aa9c962364c2fd965 /utils/src/ooinstall | |
parent | 0bac74c346bb5c620bdf1941b40c29ff3083e2b0 (diff) | |
download | openshift-203630f47e6d06e5575a9e3bb4db76cb12ead936.tar.gz openshift-203630f47e6d06e5575a9e3bb4db76cb12ead936.tar.bz2 openshift-203630f47e6d06e5575a9e3bb4db76cb12ead936.tar.xz openshift-203630f47e6d06e5575a9e3bb4db76cb12ead936.zip |
Support unicode output when dumping yaml
Diffstat (limited to 'utils/src/ooinstall')
-rw-r--r-- | utils/src/ooinstall/ansible_plugins/facts_callback.py | 14 |
1 files changed, 10 insertions, 4 deletions
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): |