From f144be5bcc0e6bbe4f5541f60bab4b513855c826 Mon Sep 17 00:00:00 2001 From: Gael Chamoulaud Date: Mon, 13 May 2019 15:50:25 +0200 Subject: [PATCH] [Python3] Adds bytes to str conversion management On RHEL8 with Python3, the template's contents returned by the Swift client get_object method is byte object and need to be converted into a string. Change-Id: Ia35abb66b9e61a7154406cf83c6da1e68a2f96b7 Signed-off-by: Gael Chamoulaud --- lookup_plugins/tht.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lookup_plugins/tht.py b/lookup_plugins/tht.py index 845c9f30f..f0921fe0d 100644 --- a/lookup_plugins/tht.py +++ b/lookup_plugins/tht.py @@ -41,6 +41,11 @@ class LookupModule(LookupBase): container = swift.get_container(variables['plan']) for item in container[1]: obj = swift.get_object(variables['plan'], item['name']) + try: + obj = (obj[0], obj[1].decode('utf-8')) + except AttributeError: + pass + if os.path.splitext(item['name'])[-1] not in EXCLUDED_EXT: ret.append((item['name'], obj))