mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Use the loaded variable since we have it assigned, not just for error detection.
This commit is contained in:
@@ -355,6 +355,7 @@ 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()
|
data = data.lstrip()
|
||||||
|
loaded = None
|
||||||
if data.startswith("{") or data.startswith("["):
|
if data.startswith("{") or 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:
|
||||||
@@ -368,7 +369,7 @@ def parse_yaml(data, path_hint=None):
|
|||||||
# else this is pretty sure to be a YAML document
|
# else this is pretty sure to be a YAML document
|
||||||
loaded = yaml.safe_load(data)
|
loaded = yaml.safe_load(data)
|
||||||
|
|
||||||
return smush_ds(yaml.safe_load(data))
|
return smush_ds(loaded)
|
||||||
|
|
||||||
def process_common_errors(msg, probline, column):
|
def process_common_errors(msg, probline, column):
|
||||||
replaced = probline.replace(" ","")
|
replaced = probline.replace(" ","")
|
||||||
|
|||||||
Reference in New Issue
Block a user