mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Display proper error on group_vars syntax error
This fix ensures a proper error is shown when a group_vars files cannot be parsed correctly. Without this patch you get: ``` [dag@moria ansible.testing]$ ansible-playbook test132.yml ERROR! Unexpected Exception: dictionary update sequence element #0 has length 1; 2 is required to see the full traceback, use -vvv ``` With this patch you get: ``` [dag@moria ansible.testing]$ ansible-playbook test132.yml ERROR! Problem parsing file '/home/dag/home-made/ansible.testing/group_vars/test135': line 1, column 1 ``` This fixes #18843
This commit is contained in:
@@ -583,8 +583,13 @@ class VariableManager:
|
||||
|
||||
rval = AnsibleInventoryVarsData()
|
||||
rval.path = path
|
||||
|
||||
if data is not None:
|
||||
rval.update(data)
|
||||
if not isinstance(data, dict):
|
||||
raise AnsibleError("Problem parsing file '%s': line %d, column %d" % data.ansible_pos)
|
||||
else:
|
||||
rval.update(data)
|
||||
|
||||
return rval
|
||||
|
||||
def add_host_vars_file(self, path, loader):
|
||||
|
||||
Reference in New Issue
Block a user