From 366e023db772a7345334efd1b97526deb4341602 Mon Sep 17 00:00:00 2001
From: Rafael Guterres Jeffman <rjeffman@redhat.com>
Date: Tue, 21 Jul 2020 16:28:18 -0300
Subject: [PATCH] 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.
---
 plugins/modules/ipadnsforwardzone.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins/modules/ipadnsforwardzone.py b/plugins/modules/ipadnsforwardzone.py
index 1f1e85ec..1ffba38e 100644
--- a/plugins/modules/ipadnsforwardzone.py
+++ b/plugins/modules/ipadnsforwardzone.py
@@ -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
 
 
-- 
GitLab