1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

convert string returned by plugin to unicode (#2329)

* convert string returned by plugin to unicode

* add changelog fragment

* fix changelog format

* fix changelog format yet again

Co-authored-by: Anubhav Chakraborty <anubchak@cisco.com>
This commit is contained in:
Anubhav Chakraborty 2021-04-24 15:50:11 +05:30 committed by GitHub
parent 2799cd4ac7
commit f11f6595cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- hiera lookup plugin - converts the return type of plugin to unicode string (https://github.com/ansible-collections/community.general/pull/2329).

View file

@ -63,6 +63,7 @@ import os
from ansible.plugins.lookup import LookupBase
from ansible.utils.cmd_functions import run_cmd
from ansible.module_utils._text import to_text
ANSIBLE_HIERA_CFG = os.getenv('ANSIBLE_HIERA_CFG', '/etc/hiera.yaml')
ANSIBLE_HIERA_BIN = os.getenv('ANSIBLE_HIERA_BIN', '/usr/bin/hiera')
@ -78,7 +79,7 @@ class Hiera(object):
rc, output, err = run_cmd("{0} -c {1} {2}".format(
ANSIBLE_HIERA_BIN, ANSIBLE_HIERA_CFG, hiera_key[0]))
return output.strip()
return to_text(output.strip())
class LookupModule(LookupBase):