Skip to content

Commit

Permalink
Merge pull request ansible#5465 from deonbredenhann/false_mandatory_v…
Browse files Browse the repository at this point in the history
…ariable

Treat a False mandatory variable as defined.
  • Loading branch information
jctanner committed Jan 14, 2014
2 parents 09f7b11 + c85aac8 commit 91c5c9d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/ansible/runner/filter_plugins/core.py
Expand Up @@ -58,7 +58,7 @@ def changed(*a, **kw):
if not 'changed' in item:
changed = False
if ('results' in item # some modules return a 'results' key
and type(item['results']) == list
and type(item['results']) == list
and type(item['results'][0]) == dict):
for result in item['results']:
changed = changed or result.get('changed', False)
Expand All @@ -76,9 +76,12 @@ def skipped(*a, **kw):

def mandatory(a):
''' Make a variable mandatory '''
if not a:
try:
a
except NameError:
raise errors.AnsibleFilterError('Mandatory variable not defined.')
return a
else:
return a

def bool(a):
''' return a bool for the arg '''
Expand Down

0 comments on commit 91c5c9d

Please sign in to comment.