diff options
author | Scott Moser <smoser@ubuntu.com> | 2015-02-24 11:58:22 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2015-02-24 11:58:22 -0500 |
commit | f1ee9275a504c20153b795923b1f51d3005d745c (patch) | |
tree | 626ec9f03f7bfab4c8107a46ab0680420eb6b8e9 /cloudinit/user_data.py | |
parent | 43a8d82141c5abcdf5ca546fd5a8ebc95cb3cbaf (diff) | |
download | vyos-cloud-init-f1ee9275a504c20153b795923b1f51d3005d745c.tar.gz vyos-cloud-init-f1ee9275a504c20153b795923b1f51d3005d745c.zip |
use util.decode_binary rather than str, add tests.
just seems to make more sense to decode here.
Add a test showing the previous failure (testBytesInPayload)
And one that should pass (testStringInPayload)
Also, add a test for unencoded content in the ovf xml (test_userdata_plain)
And explicitly set encoding on another test (test_userdata_found).
Diffstat (limited to 'cloudinit/user_data.py')
-rw-r--r-- | cloudinit/user_data.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cloudinit/user_data.py b/cloudinit/user_data.py index 8fd7fba5..b11894ce 100644 --- a/cloudinit/user_data.py +++ b/cloudinit/user_data.py @@ -336,8 +336,8 @@ def convert_string(raw_data, headers=None): raw_data = '' if not headers: headers = {} - data = util.decomp_gzip(raw_data) - if "mime-version:" in str(data[0:4096]).lower(): + data = util.decode_binary(util.decomp_gzip(raw_data)) + if "mime-version:" in data[0:4096].lower(): msg = email.message_from_string(data) for (key, val) in headers.items(): _replace_header(msg, key, val) |