moved mandatory back to filters as it does not always return a boolean, it does an exception on failure

This commit is contained in:
Brian Coca 2015-08-21 09:54:56 -04:00
parent 01708cc824
commit f150fe2c23
2 changed files with 10 additions and 11 deletions

View file

@ -79,14 +79,6 @@ def search(value, pattern='', ignorecase=False):
''' Perform a `re.search` returning a boolean '''
return regex(value, pattern, ignorecase, 'search')
def mandatory(a):
from jinja2.runtime import Undefined
''' Make a variable mandatory '''
if isinstance(a, Undefined):
raise errors.AnsibleFilterError('Mandatory variable not defined.')
return a
class TestModule(object):
''' Ansible core jinja2 tests '''
@ -102,9 +94,6 @@ class TestModule(object):
# skip testing
'skipped' : skipped,
# variable existence
'mandatory': mandatory,
# regex
'match': match,
'search': search,