Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
salt.3892
0003-Check-if-byte-strings-are-properly-encoded...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0003-Check-if-byte-strings-are-properly-encoded-in-UTF-8.patch of Package salt.3892
From 72e7bd2ca41d9d5eafcb93f14ab48792532d52b9 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/38] 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 3348d0c..a1c2bdb 100644 --- a/salt/modules/zypper.py +++ b/salt/modules/zypper.py @@ -359,9 +359,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 @@ -374,7 +374,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(): @@ -385,7 +386,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.10.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor