I’m getting the following error:
`
ERROR: failed to combine variables, expected dicts but got a ‘dict’ and a ‘str’
`
with the following setup:
`
I’m getting the following error:
`
ERROR: failed to combine variables, expected dicts but got a ‘dict’ and a ‘str’
`
with the following setup:
`
I have created the following pull request to fix this issue:
https://github.com/ansible/ansible/pull/10328
That reason seems to be, merging happens on higher-level internal
variables (setup cache, various play vars, inventory vars, etc.)
The merge_hash then happens recursively, which is why you see that error,
even if you don;t have the merge setting.
I'm not sure your proposed patch solves the deeper issue, only what happens
in your case, and might potentially break other things.
The issue here is {{ my_xxx }} being cast to a string instead of a
dictionary.
Thanks for your comments, Serge.
I’m not sure your proposed patch solves the deeper issue, only what happens in your case, and might potentially break other things.
It depends for what the function is used. If it’s used to merge variables on the same level (vars_files, vars, …), then it should not break anything.
The issue here is
{{ my_xxx }}
being cast to a string instead of a dictionary.
Yes, that’s exactly the problem. It’s interesting that in the case of lists it works just fine. One would expect that the same concept could be used for lists as well as for dicts.
I am currently testing, https://github.com/ansible/ansible/pull/10329
<= attempt to correct the deeper issue, this is has been in 1.8 since
a re-factoring on variable merging started using the wrong function.
Any help testing this PR will be appreciated, this can have far
reaching consequences.