summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2016-08-09 20:50:30 +0200
committerAlexander Sulfrian <asulfrian@zedat.fu-berlin.de>2022-01-16 09:35:03 +0100
commit874b19c2e122a6aba652446ad56615855091b568 (patch)
tree3bef72c6c111bd8eaf4caa1fa173ff39793067d5
parent1445855daba8bf6978eea3686fe6858ad77fcf8f (diff)
downloadbcfg2-874b19c2e122a6aba652446ad56615855091b568.tar.gz
bcfg2-874b19c2e122a6aba652446ad56615855091b568.tar.bz2
bcfg2-874b19c2e122a6aba652446ad56615855091b568.zip
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.
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Pkgng.py4
1 files changed, 1 insertions, 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: