mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
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 '''
|
||||
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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue