Make mandatory filter error message more verbose (#44139)
...by adding the undefined variable/attribute name, if available.
This commit is contained in:
parent
9abe66845f
commit
e5f4987a8f
1 changed files with 5 additions and 1 deletions
|
@ -299,7 +299,11 @@ def mandatory(a):
|
||||||
|
|
||||||
''' Make a variable mandatory '''
|
''' Make a variable mandatory '''
|
||||||
if isinstance(a, Undefined):
|
if isinstance(a, Undefined):
|
||||||
raise AnsibleFilterError('Mandatory variable not defined.')
|
if a._undefined_name is not None:
|
||||||
|
name = "'%s' " % to_text(a._undefined_name)
|
||||||
|
else:
|
||||||
|
name = ''
|
||||||
|
raise AnsibleFilterError("Mandatory variable %snot defined." % name)
|
||||||
return a
|
return a
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue