From 48d84a5422dc6ebee3df7495978b2e7f75551d0f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 2 Aug 2021 14:35:59 -0400 Subject: [PATCH] Fix get_json Some handlers may work in bytes or str, normalize to str on the way out. --- imgutil/imgutil | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/imgutil/imgutil b/imgutil/imgutil index 03b119a1..32cbead1 100644 --- a/imgutil/imgutil +++ b/imgutil/imgutil @@ -359,8 +359,12 @@ class OsHandler(object): self.osname = '{}-{}-{}'.format(name, version, arch) def get_json(self): - info = {'oscategory': self.oscategory, - 'version': self.version, 'arch': self.arch, 'name': self.name} + odata = [self.oscategory, self.version, self.arch, self.name] + for idx in range(len(odata)): + if not isinstance(odata[idx], str): + odata[idx] = odata[idx].decode('utf8') + info = {'oscategory': odata[0], + 'version': odata[1], 'arch': odata[2], 'name': odata[3]} return json.dumps(info) def list_packages(self):