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:
parent
2799cd4ac7
commit
f11f6595cc
2 changed files with 4 additions and 1 deletions
|
@ -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).
|
|
@ -63,6 +63,7 @@ import os
|
||||||
|
|
||||||
from ansible.plugins.lookup import LookupBase
|
from ansible.plugins.lookup import LookupBase
|
||||||
from ansible.utils.cmd_functions import run_cmd
|
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_CFG = os.getenv('ANSIBLE_HIERA_CFG', '/etc/hiera.yaml')
|
||||||
ANSIBLE_HIERA_BIN = os.getenv('ANSIBLE_HIERA_BIN', '/usr/bin/hiera')
|
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(
|
rc, output, err = run_cmd("{0} -c {1} {2}".format(
|
||||||
ANSIBLE_HIERA_BIN, ANSIBLE_HIERA_CFG, hiera_key[0]))
|
ANSIBLE_HIERA_BIN, ANSIBLE_HIERA_CFG, hiera_key[0]))
|
||||||
|
|
||||||
return output.strip()
|
return to_text(output.strip())
|
||||||
|
|
||||||
|
|
||||||
class LookupModule(LookupBase):
|
class LookupModule(LookupBase):
|
||||||
|
|
Loading…
Reference in a new issue