From 4f1f13b100dbdbbf786ef8b3db8cf96596cce115 Mon Sep 17 00:00:00 2001 From: Deon Bredenhann Date: Tue, 31 Dec 2013 13:40:21 +0200 Subject: [PATCH 1/2] Remove trailing space --- lib/ansible/runner/filter_plugins/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/runner/filter_plugins/core.py b/lib/ansible/runner/filter_plugins/core.py index 495e17e2fa0..f44089c7505 100644 --- a/lib/ansible/runner/filter_plugins/core.py +++ b/lib/ansible/runner/filter_plugins/core.py @@ -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) From c85aac8b173ec13b844aa35cd60f00015a7d1b42 Mon Sep 17 00:00:00 2001 From: Deon Bredenhann Date: Tue, 31 Dec 2013 13:41:40 +0200 Subject: [PATCH 2/2] 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 f44089c7505..1cd53bbaa33 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 '''