diff --git a/changelogs/fragments/64032-zabbix_template_fix_return_XML_as_a_string_even_python3.yml b/changelogs/fragments/64032-zabbix_template_fix_return_XML_as_a_string_even_python3.yml new file mode 100644 index 0000000000..b11b6306d1 --- /dev/null +++ b/changelogs/fragments/64032-zabbix_template_fix_return_XML_as_a_string_even_python3.yml @@ -0,0 +1,2 @@ +bugfixes: + - Fix to return XML as a string even for python3 (https://github.com/ansible/ansible/pull/64032). diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_template.py b/lib/ansible/modules/monitoring/zabbix/zabbix_template.py index 275288d7f5..c93e77a5cd 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_template.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_template.py @@ -454,7 +454,7 @@ class Template(object): try: dump = self._zapi.configuration.export({'format': template_type, 'options': {'templates': template_ids}}) if template_type == 'xml': - return str(ET.tostring(ET.fromstring(dump.encode('utf-8')), encoding='utf-8')) + return str(ET.tostring(ET.fromstring(dump.encode('utf-8')), encoding='utf-8').decode('utf-8')) else: return self.load_json_template(dump)