From c85aac8b173ec13b844aa35cd60f00015a7d1b42 Mon Sep 17 00:00:00 2001 From: Deon Bredenhann Date: Tue, 31 Dec 2013 13:41:40 +0200 Subject: [PATCH] Treat a False mandatory variable as defined. --- lib/ansible/runner/filter_plugins/core.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner/filter_plugins/core.py b/lib/ansible/runner/filter_plugins/core.py index f44089c750..1cd53bbaa3 100644 --- a/lib/ansible/runner/filter_plugins/core.py +++ b/lib/ansible/runner/filter_plugins/core.py @@ -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 '''