mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Make mandatory filter error message more verbose (#44139)
...by adding the undefined variable/attribute name, if available.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user