summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2014-01-10 17:38:11 -0800
committerJoshua Harlow <harlowja@yahoo-inc.com>2014-01-10 17:38:11 -0800
commit6f8c1d62e406675ad8524ce4fa97eac958d42238 (patch)
tree6c27a3dbf28480b50932e8420ed2ff421f63dd67 /cloudinit
parent4b70c9a952f0d12a3379cd5c1d930c20f5154134 (diff)
downloadvyos-cloud-init-6f8c1d62e406675ad8524ce4fa97eac958d42238.tar.gz
vyos-cloud-init-6f8c1d62e406675ad8524ce4fa97eac958d42238.zip
Only check for json objects instead of also arrays
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/ec2_utils.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/cloudinit/ec2_utils.py b/cloudinit/ec2_utils.py
index 525059f7..1fd674bb 100644
--- a/cloudinit/ec2_utils.py
+++ b/cloudinit/ec2_utils.py
@@ -28,14 +28,12 @@ from cloudinit import util
LOG = logging.getLogger(__name__)
-def maybe_json(text):
+def maybe_json_object(text):
if not text:
return False
text = text.strip()
if text.startswith("{") and text.endswith("}"):
return True
- if text.startswith("[") and text.endswith("]"):
- return True
return False
@@ -108,7 +106,7 @@ class MetadataMaterializer(object):
def _decode_leaf_blob(self, field, blob):
if not blob:
return blob
- if maybe_json(blob):
+ if maybe_json_object(blob):
try:
# Assume it's json, unless it fails parsing...
return json.loads(blob)