Fixes #5238 Improve error messaging about unquoted variable references in playbooks
This commit is contained in:
parent
57d54c1da5
commit
d6b78e9dd6
1 changed files with 23 additions and 1 deletions
|
@ -447,8 +447,30 @@ Note: The error may actually appear before this position: line %s, column %s
|
||||||
%s
|
%s
|
||||||
%s""" % (path, mark.line + 1, mark.column + 1, before_probline, probline, arrow)
|
%s""" % (path, mark.line + 1, mark.column + 1, before_probline, probline, arrow)
|
||||||
|
|
||||||
msg = process_common_errors(msg, probline, mark.column)
|
unquoted_var = None
|
||||||
|
if '{{' in probline and '}}' in probline:
|
||||||
|
if '"{{' not in probline or "'{{" not in probline:
|
||||||
|
unquoted_var = True
|
||||||
|
|
||||||
|
msg = process_common_errors(msg, probline, mark.column)
|
||||||
|
if not unquoted_var:
|
||||||
|
msg = process_common_errors(msg, probline, mark.column)
|
||||||
|
else:
|
||||||
|
msg = msg + """
|
||||||
|
We could be wrong, but this one looks like it might be an issue with
|
||||||
|
missing quotes. Always quote template expression brackets when they
|
||||||
|
start a value. For instance:
|
||||||
|
|
||||||
|
with_items:
|
||||||
|
- {{ foo }}
|
||||||
|
|
||||||
|
Should be written as:
|
||||||
|
|
||||||
|
with_items:
|
||||||
|
- "{{ foo }}"
|
||||||
|
|
||||||
|
"""
|
||||||
|
msg = process_common_errors(msg, probline, mark.column)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# No problem markers means we have to throw a generic
|
# No problem markers means we have to throw a generic
|
||||||
|
|
Loading…
Reference in a new issue