Strip any whitespace before checking for json

In case the template has any whitespace
we should strip it before checking if the
first character is a "{" to determine that its
a json template

Change-Id: Ia25444a2fde7019aa9fdf0d782599be78305ae9c
Closes-Bug: #1546166
This commit is contained in:
Itxaka
2016-02-16 17:03:50 +01:00
committed by Itxaka Serrano Garcia
parent 4f4575565c
commit 9c56e52a26

View File

@@ -45,6 +45,8 @@ def parse(tmpl_str):
This includes determination of whether the string is using the
JSON or YAML format.
"""
# strip any whitespace before the check
tmpl_str = tmpl_str.strip()
if tmpl_str.startswith('{'):
tpl = json.loads(tmpl_str)
else: