Fix invalid forwarder list due to not using Unicode text.

When using ipadnsfowardzone with a target host that uses Python 2,
it fails to add new zones due to unicode and str being different on
that version. This patch fixes this behavior ensuring the module
works on both Python verisons 2.7 and 3.x.
This commit is contained in:
Rafael Guterres Jeffman
2020-07-21 16:28:18 -03:00
parent c2f68a3401
commit 366e023db7

View File

@@ -106,6 +106,7 @@ RETURN = '''
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_text
from ansible.module_utils.ansible_freeipa_module import temp_kinit, \
temp_kdestroy, valid_creds, api_connect, api_command, compare_args_ipa, \
module_params_get
@@ -150,7 +151,7 @@ def forwarder_list(forwarders):
formatter = "{ip_address} port {port}"
else:
formatter = "{ip_address}"
fwd_list.append(formatter.format(**forwarder))
fwd_list.append(to_text(formatter.format(**forwarder)))
return fwd_list