From 874b19c2e122a6aba652446ad56615855091b568 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Tue, 9 Aug 2016 20:50:30 +0200 Subject: Packages: Ignore unicode errors in pkgng metadata The messages of the packages in the packagesite file may be encoded in any encoding. We only need the dependencies and just ignore the unicode errors. --- src/lib/Bcfg2/Server/Plugins/Packages/Pkgng.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Pkgng.py b/src/lib/Bcfg2/Server/Plugins/Packages/Pkgng.py index 4938efb94..55dd4e488 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Pkgng.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Pkgng.py @@ -76,9 +76,7 @@ class PkgngSource(Source): self.logger.error("Packages: Failed to read file %s" % fname) raise for line in reader.readlines(): - if not isinstance(line, str): - line = line.decode('utf-8') - pkg = json.loads(line) + pkg = json.loads(unicode(line, errors='ignore')) pkgname = pkg['name'] self.pkgnames.add(pkgname) if 'deps' in pkg: -- cgit v1.2.3-1-g7c22