From 6f8c1d62e406675ad8524ce4fa97eac958d42238 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Fri, 10 Jan 2014 17:38:11 -0800 Subject: Only check for json objects instead of also arrays --- cloudinit/ec2_utils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'cloudinit/ec2_utils.py') 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) -- cgit v1.2.3