From 4b400ca5e97eeccfb1bd00457634b83ac2f5ef44 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Mon, 10 Mar 2014 13:43:34 -0500 Subject: [PATCH] Only used stripped data for testing if the file is json, but used unstripped when actually parsing. Fixes #6348 --- lib/ansible/utils/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index 405641eb163..6c2f8112aba 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -354,9 +354,9 @@ def smush_ds(data): def parse_yaml(data, path_hint=None): ''' convert a yaml string to a data structure. Also supports JSON, ssssssh!!!''' - data = data.lstrip() + stripped_data = data.lstrip() loaded = None - if data.startswith("{") or data.startswith("["): + if stripped_data.startswith("{") or stripped_data.startswith("["): # since the line starts with { or [ we can infer this is a JSON document. try: loaded = json.loads(data)