SHA256
1
0
forked from pool/salt
salt/0003-Check-if-byte-strings-are-properly-encoded-in-UTF-8.patch
Klaus Kämpf 14ef6d2b51 Accepting request 430691 from systemsmanagement:saltstack:testing
- splitting out the susemanager integration plugins into their own
  subpackages. ATM this only contains the zypp plugin to tell
  susemanager about manually installed packages.

- Unit and integration tests fixes for 2016.3.2
  Add:
  * 0018-Unit-tests-fixes-for-2016.3.2.patch
  * 0019-Fix-snapper_test-for-python26.patch
  * 0020-Integration-tests-fixes-for-2016.3.2.patch

- Prevent pkg.install failure for expired keys (bsc#996455)
  Add:
  * 0017-Check-for-single-quote-before-splitting-on-single-qu.patch

- Required D-Bus and generating machine ID where it is missing

- Fix sphinx crashes when documentation is being generated
  Add script for documentation update.
  Add:
  * 0016-Improve-Mock-to-be-flexible-and-able-to-mock-methods.patch
  * update-documentation.sh

- Fix pkg.installed refresh repo failure (bsc#993549)
  Fix salt.states.pkgrepo.management no change failure (bsc#990440)
  Add:
  * 0014-Add-ignore_repo_failure-option-to-suppress-zypper-s-.patch
  * 0015-Remove-zypper-s-raise-exception-if-mod_repo-has-no-a.patch

- Deprecate status.uptime one version later
  Add:

OBS-URL: https://build.opensuse.org/request/show/430691
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=77
2016-09-28 07:49:13 +00:00

50 lines
2.6 KiB
Diff

From cad9f1a8fda2a4d8c666abcf74e03e7c6a8eb6be Mon Sep 17 00:00:00 2001
From: Bo Maryniuk <bo@suse.de>
Date: Mon, 18 Jan 2016 16:28:48 +0100
Subject: [PATCH 03/12] Check if byte strings are properly encoded in UTF-8
Rename keywords arguments variable to a default name.
---
salt/modules/zypper.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 7dd73dd..92c604e 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -335,9 +335,9 @@ def info_installed(*names, **kwargs):
summary, description.
:param errors:
- Handle RPM field errors (true|false). By default, various mistakes in the textual fields are simply ignored and
- omitted from the data. Otherwise a field with a mistake is not returned, instead a 'N/A (bad UTF-8)'
- (not available, broken) text is returned.
+ Handle RPM field errors. If 'ignore' is chosen, then various mistakes are simply ignored and omitted
+ from the texts or strings. If 'report' is chonen, then a field with a mistake is not returned, instead
+ a 'N/A (broken)' (not available, broken) text is placed.
Valid attributes are:
ignore, report
@@ -350,7 +350,8 @@ def info_installed(*names, **kwargs):
salt '*' pkg.info_installed <package1> <package2> <package3> ...
salt '*' pkg.info_installed <package1> attr=version,vendor
salt '*' pkg.info_installed <package1> <package2> <package3> ... attr=version,vendor
- salt '*' pkg.info_installed <package1> <package2> <package3> ... attr=version,vendor errors=true
+ salt '*' pkg.info_installed <package1> <package2> <package3> ... attr=version,vendor errors=ignore
+ salt '*' pkg.info_installed <package1> <package2> <package3> ... attr=version,vendor errors=report
'''
ret = dict()
for pkg_name, pkg_nfo in __salt__['lowpkg.info'](*names, **kwargs).items():
@@ -361,7 +362,7 @@ def info_installed(*names, **kwargs):
# Check, if string is encoded in a proper UTF-8
value_ = value.decode('UTF-8', 'ignore').encode('UTF-8', 'ignore')
if value != value_:
- value = kwargs.get('errors') and value_ or 'N/A (invalid UTF-8)'
+ value = kwargs.get('errors', 'ignore') == 'ignore' and value_ or 'N/A (invalid UTF-8)'
log.error('Package {0} has bad UTF-8 code in {1}: {2}'.format(pkg_name, key, value))
if key == 'source_rpm':
t_nfo['source'] = value
--
2.9.2