mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02: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:
parent
5d82fe545f
commit
41614fd8e6
1 changed files with 6 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue