diff options
author | Barry Warsaw <barry@python.org> | 2015-01-27 15:03:52 -0500 |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2015-01-27 15:03:52 -0500 |
commit | 6e742d20e9ed56498925c7c850cd5da65d063b4b (patch) | |
tree | 3e584ae2381d72d2b77c6f2d98c9be93bcb9e413 /cloudinit/sources/DataSourceOpenNebula.py | |
parent | 69c64029997599b3f1764ef48fe571094e2ee5f2 (diff) | |
download | vyos-cloud-init-6e742d20e9ed56498925c7c850cd5da65d063b4b.tar.gz vyos-cloud-init-6e742d20e9ed56498925c7c850cd5da65d063b4b.zip |
Respond to review:
- Refactor both the base64 encoding and decoding into utility functions.
Also:
- Mechanically fix some other broken untested code.
Diffstat (limited to 'cloudinit/sources/DataSourceOpenNebula.py')
-rw-r--r-- | cloudinit/sources/DataSourceOpenNebula.py | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/cloudinit/sources/DataSourceOpenNebula.py b/cloudinit/sources/DataSourceOpenNebula.py index a0275cda..61709c1b 100644 --- a/cloudinit/sources/DataSourceOpenNebula.py +++ b/cloudinit/sources/DataSourceOpenNebula.py @@ -426,12 +426,7 @@ def read_context_disk_dir(source_dir, asuser=None): context.get('USER_DATA_ENCODING')) if encoding == "base64": try: - userdata = base64.b64decode(results['userdata']) - # In Python 3 we still expect a str, but b64decode will return - # bytes. Convert to str. - if isinstance(userdata, bytes): - userdata = userdata.decode('utf-8') - results['userdata'] = userdata + results['userdata'] = util.b64d(results['userdata']) except TypeError: LOG.warn("Failed base64 decoding of userdata") |