Fixing broken patch 20957a1

Also adds integration tests for nested includes with conditionals
This commit is contained in:
James Cammarata 2014-08-11 14:52:21 -05:00
parent b0295af7ee
commit 783a1e3dfc
4 changed files with 14 additions and 4 deletions

View file

@ -540,11 +540,10 @@ class Play(object):
elif k.startswith("when_"):
utils.deprecated("\"when_<criteria>:\" is a removed deprecated feature, use the simplified 'when:' conditional directly", None, removed=True)
elif k == 'when':
if type(x[k]) is str:
included_additional_conditions.insert(0, x[k])
if isinstance(x[k], (basestring, bool)):
included_additional_conditions.append(x[k])
elif type(x[k]) is list:
for i in x[k]:
included_additional_conditions.insert(0, i)
included_additional_conditions.extend(x[k])
elif k in ("include", "vars", "default_vars", "sudo", "sudo_user", "role_name", "no_log"):
continue
else:

View file

@ -164,3 +164,11 @@
- result.invocation.module_name == "debug"
- result.msg == "this should be debugged"
- name: test conditional includes
include: test_include_conditional.yml
when: false
- name: assert the nested include from test_include_conditional was not set
assert:
that:
- nested_include_var is undefined

View file

@ -0,0 +1 @@
- include: test_include_nested.yml

View file

@ -0,0 +1,2 @@
- name: set the nested include fact
set_fact: nested_include_var=1