From e486dbab04d44dc0aac7ca2fefd769d2a3e95775 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Thu, 6 Mar 2014 22:15:21 -0500 Subject: [PATCH] Use the loaded variable since we have it assigned, not just for error detection. --- lib/ansible/utils/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index dd2989a94b5..405641eb163 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -355,6 +355,7 @@ def parse_yaml(data, path_hint=None): ''' convert a yaml string to a data structure. Also supports JSON, ssssssh!!!''' data = data.lstrip() + loaded = None if data.startswith("{") or data.startswith("["): # since the line starts with { or [ we can infer this is a JSON document. try: @@ -368,7 +369,7 @@ def parse_yaml(data, path_hint=None): # else this is pretty sure to be a YAML document loaded = yaml.safe_load(data) - return smush_ds(yaml.safe_load(data)) + return smush_ds(loaded) def process_common_errors(msg, probline, column): replaced = probline.replace(" ","")