Fixing broken patch 20957a1

Also adds integration tests for nested includes with conditionals
pull/8558/head
James Cammarata 10 years ago
parent b0295af7ee
commit 783a1e3dfc

@ -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:

@ -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

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