From 4078dcbb773a4ea8a1f83d832aa25352480ab2dc Mon Sep 17 00:00:00 2001 From: sky-joker Date: Thu, 7 Nov 2019 22:21:14 +0900 Subject: [PATCH] Zabbix: zabbix_template: fix https://github.com/ansible/ansible/issues/64030 (#64032) add zabbix_template changelog --- ...-zabbix_template_fix_return_XML_as_a_string_even_python3.yml | 2 ++ lib/ansible/modules/monitoring/zabbix/zabbix_template.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/64032-zabbix_template_fix_return_XML_as_a_string_even_python3.yml 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 00000000000..b11b6306d1d --- /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 275288d7f55..c93e77a5cd4 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)