summaryrefslogtreecommitdiff
path: root/heatclient
diff options
context:
space:
mode:
authorCyril Roelandt <cyril.roelandt@enovance.com>2014-03-06 15:44:10 +0100
committerCyril Roelandt <cyril.roelandt@enovance.com>2014-03-22 06:14:38 +0100
commit30ce6d920f66571e5199828b66a0fe4dbf25c2c2 (patch)
treeb3c29e7197fb73fd6f809d58e018548499308695 /heatclient
parent644d1489191696642b50cfa582df92ca8499e7d0 (diff)
downloadpython-heatclient-30ce6d920f66571e5199828b66a0fe4dbf25c2c2.tar.gz
Python 3: decode bytes before feeding them to jsonutils.loads()
urlopen(...).read() returns bytes in Python 3, so we cannot call jsonutils.loads() on the output: we first have to decode() it. Change-Id: I39504059a8c82347476dd88dfcbd060d58df13d0
Diffstat (limited to 'heatclient')
-rw-r--r--heatclient/v1/shell.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/heatclient/v1/shell.py b/heatclient/v1/shell.py
index 1d65c64..cefe368 100644
--- a/heatclient/v1/shell.py
+++ b/heatclient/v1/shell.py
@@ -14,6 +14,7 @@
# under the License.
import logging
+import six
from six.moves.urllib import request
import yaml
@@ -647,6 +648,8 @@ def do_resource_signal(hc, args):
data_url = template_utils.normalise_file_path_to_url(data_file)
data = request.urlopen(data_url).read()
if data:
+ if isinstance(data, six.binary_type):
+ data = data.decode('utf-8')
try:
data = jsonutils.loads(data)
except ValueError as ex: