SHA256
1
0
forked from pool/cloud-init
cloud-init/cloud-init-ostack-metadat-dencode.patch

15 lines
749 B
Diff

--- cloudinit/sources/helpers/openstack.py.orig
+++ cloudinit/sources/helpers/openstack.py
@@ -291,7 +291,10 @@ class BaseReader(object):
if 'random_seed' in metadata:
random_seed = metadata['random_seed']
try:
- metadata['random_seed'] = base64.b64decode(random_seed)
+ metadata['random_seed'] = u'%s' % base64.b64decode(random_seed)
+ except UnicodeDecodeError:
+ # Did not decode as expected, probably utf-8 already
+ metadata['random_seed'] = random_seed
except (ValueError, TypeError) as e:
raise BrokenMetadata("Badly formatted metadata"
" random_seed entry: %s" % e)