mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #6377 from sivel/issue/6348
Don't lstrip data to be parsed by parse_yaml. Fixes #6384
This commit is contained in:
commit
d9c22cd997
1 changed files with 2 additions and 2 deletions
|
@ -354,9 +354,9 @@ def smush_ds(data):
|
||||||
def parse_yaml(data, path_hint=None):
|
def parse_yaml(data, path_hint=None):
|
||||||
''' convert a yaml string to a data structure. Also supports JSON, ssssssh!!!'''
|
''' convert a yaml string to a data structure. Also supports JSON, ssssssh!!!'''
|
||||||
|
|
||||||
data = data.lstrip()
|
stripped_data = data.lstrip()
|
||||||
loaded = None
|
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.
|
# since the line starts with { or [ we can infer this is a JSON document.
|
||||||
try:
|
try:
|
||||||
loaded = json.loads(data)
|
loaded = json.loads(data)
|
||||||
|
|
Loading…
Reference in a new issue