File remove-obsolete-unicode-handling-in-pkg.info_install.patch of Package salt.7664
From dc262b912c63ed0d3152a01c9eaaa3ec3f8e0f7e Mon Sep 17 00:00:00 2001
From: Mihai Dinca <mdinca@suse.de>
Date: Tue, 13 Feb 2018 16:11:20 +0100
Subject: [PATCH] Remove obsolete unicode handling in pkg.info_installed
---
salt/modules/zypper.py | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 51d01c3fc9..16fc877684 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -309,7 +309,11 @@ class _Zypper(object):
if self.error_msg and not self.__no_raise and not self.__ignore_repo_failure:
raise CommandExecutionError('Zypper command failure: {0}'.format(self.error_msg))
- return self._is_xml_mode() and dom.parseString(self.__call_result['stdout']) or self.__call_result['stdout']
+ return (
+ self._is_xml_mode() and
+ dom.parseString(salt.utils.stringutils.to_str(self.__call_result['stdout'])) or
+ self.__call_result['stdout']
+ )
__zypper__ = _Zypper()
@@ -482,15 +486,6 @@ def info_installed(*names, **kwargs):
t_nfo = dict()
# Translate dpkg-specific keys to a common structure
for key, value in six.iteritems(pkg_nfo):
- if isinstance(value, six.string_types):
- # Check, if string is encoded in a proper UTF-8
- if six.PY3:
- value_ = value.encode('UTF-8', 'ignore').decode('UTF-8', 'ignore')
- else:
- value_ = value.decode('UTF-8', 'ignore').encode('UTF-8', 'ignore')
- if value != value_:
- value = kwargs.get('errors', 'ignore') == 'ignore' and value_ or 'N/A (invalid UTF-8)'
- log.error('Package %s has bad UTF-8 code in %s: %s', pkg_name, key, value)
if key == 'source_rpm':
t_nfo['source'] = value
else:
--
2.16.2