diff options
author | Robert Schweikert <rjschwei@suse.com> | 2016-09-15 12:05:15 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2016-09-21 22:07:04 -0400 |
commit | 0439d8a17d181a2546f2f7cb2d71a04bbb13b186 (patch) | |
tree | 9014243afbc5a90733e63e64343f4e118aaa227a /cloudinit | |
parent | 1b71b474c0fc06e67aab8676268fd83d99091910 (diff) | |
download | vyos-cloud-init-0439d8a17d181a2546f2f7cb2d71a04bbb13b186.tar.gz vyos-cloud-init-0439d8a17d181a2546f2f7cb2d71a04bbb13b186.zip |
Decode unicode types in decode_binary
The test in decode_binary for six.text_type was incorrect as that includes
unicode type in Python 2 which should actually be decoded.
When the type is string_types we now properly check only for basestring and
str in Python 2 and Python 3 respectively and return the given blob without
making an attempt to decode.
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/util.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py index 05cb587c..eb3e5899 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -154,7 +154,7 @@ def target_path(target, path=None): def decode_binary(blob, encoding='utf-8'): # Converts a binary type into a text type using given encoding. - if isinstance(blob, six.text_type): + if isinstance(blob, six.string_types): return blob return blob.decode(encoding) |