mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Removing cruft leftover from the deprecation of include+with_items
Also cleaning up integration tests that had checks for the empty item attribute in certain results. Fixes #7535
This commit is contained in:
parent
2f7e720b90
commit
74f20ebf79
5 changed files with 16 additions and 26 deletions
|
@ -526,7 +526,6 @@ class Play(object):
|
||||||
|
|
||||||
if 'include' in x:
|
if 'include' in x:
|
||||||
tokens = shlex.split(str(x['include']))
|
tokens = shlex.split(str(x['include']))
|
||||||
items = ['']
|
|
||||||
included_additional_conditions = list(additional_conditions)
|
included_additional_conditions = list(additional_conditions)
|
||||||
include_vars = {}
|
include_vars = {}
|
||||||
for k in x:
|
for k in x:
|
||||||
|
@ -572,24 +571,22 @@ class Play(object):
|
||||||
if 'role_name' in x:
|
if 'role_name' in x:
|
||||||
new_role = x['role_name']
|
new_role = x['role_name']
|
||||||
|
|
||||||
for item in items:
|
mv = task_vars.copy()
|
||||||
mv = task_vars.copy()
|
for t in tokens[1:]:
|
||||||
mv['item'] = item
|
(k,v) = t.split("=", 1)
|
||||||
for t in tokens[1:]:
|
mv[k] = template(self.basedir, v, mv)
|
||||||
(k,v) = t.split("=", 1)
|
dirname = self.basedir
|
||||||
mv[k] = template(self.basedir, v, mv)
|
if original_file:
|
||||||
dirname = self.basedir
|
dirname = os.path.dirname(original_file)
|
||||||
if original_file:
|
include_file = template(dirname, tokens[0], mv)
|
||||||
dirname = os.path.dirname(original_file)
|
include_filename = utils.path_dwim(dirname, include_file)
|
||||||
include_file = template(dirname, tokens[0], mv)
|
data = utils.parse_yaml_from_file(include_filename, vault_password=self.vault_password)
|
||||||
include_filename = utils.path_dwim(dirname, include_file)
|
if 'role_name' in x and data is not None:
|
||||||
data = utils.parse_yaml_from_file(include_filename, vault_password=self.vault_password)
|
for y in data:
|
||||||
if 'role_name' in x and data is not None:
|
if isinstance(y, dict) and 'include' in y:
|
||||||
for y in data:
|
y['role_name'] = new_role
|
||||||
if isinstance(y, dict) and 'include' in y:
|
loaded = self._load_tasks(data, mv, default_vars, included_sudo_vars, list(included_additional_conditions), original_file=include_filename, role_name=new_role)
|
||||||
y['role_name'] = new_role
|
results += loaded
|
||||||
loaded = self._load_tasks(data, mv, default_vars, included_sudo_vars, list(included_additional_conditions), original_file=include_filename, role_name=new_role)
|
|
||||||
results += loaded
|
|
||||||
elif type(x) == dict:
|
elif type(x) == dict:
|
||||||
task = Task(
|
task = Task(
|
||||||
self, x,
|
self, x,
|
||||||
|
|
|
@ -63,7 +63,6 @@
|
||||||
that:
|
that:
|
||||||
- "'invocation' in apt_result"
|
- "'invocation' in apt_result"
|
||||||
- "'changed' in apt_result"
|
- "'changed' in apt_result"
|
||||||
- "'item' in apt_result"
|
|
||||||
- "'stderr' in apt_result"
|
- "'stderr' in apt_result"
|
||||||
- "'stdout' in apt_result"
|
- "'stdout' in apt_result"
|
||||||
- "'stdout_lines' in apt_result"
|
- "'stdout_lines' in apt_result"
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
- "'end' in async_result"
|
- "'end' in async_result"
|
||||||
- "'finished' in async_result"
|
- "'finished' in async_result"
|
||||||
- "'invocation' in async_result"
|
- "'invocation' in async_result"
|
||||||
- "'item' in async_result"
|
|
||||||
- "'rc' in async_result"
|
- "'rc' in async_result"
|
||||||
- "'start' in async_result"
|
- "'start' in async_result"
|
||||||
- "'stderr' in async_result"
|
- "'stderr' in async_result"
|
||||||
|
|
|
@ -191,7 +191,6 @@
|
||||||
that:
|
that:
|
||||||
- 'result.changed'
|
- 'result.changed'
|
||||||
- 'result.group_id.startswith("sg-")'
|
- 'result.group_id.startswith("sg-")'
|
||||||
- 'result.item == ""'
|
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
- name: test state=present (expected changed=false)
|
- name: test state=present (expected changed=false)
|
||||||
|
@ -209,7 +208,6 @@
|
||||||
that:
|
that:
|
||||||
- 'not result.changed'
|
- 'not result.changed'
|
||||||
- 'result.group_id.startswith("sg-")'
|
- 'result.group_id.startswith("sg-")'
|
||||||
- 'result.item == ""'
|
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
- name: test state=absent (expected changed=true)
|
- name: test state=absent (expected changed=true)
|
||||||
|
@ -228,7 +226,6 @@
|
||||||
that:
|
that:
|
||||||
- 'result.changed'
|
- 'result.changed'
|
||||||
- 'not result.group_id'
|
- 'not result.group_id'
|
||||||
- 'result.item == ""'
|
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
- name: test state=absent (expected changed=false)
|
- name: test state=absent (expected changed=false)
|
||||||
|
@ -247,4 +244,3 @@
|
||||||
that:
|
that:
|
||||||
- 'not result.changed'
|
- 'not result.changed'
|
||||||
- 'not result.group_id'
|
- 'not result.group_id'
|
||||||
- 'result.item == ""'
|
|
||||||
|
|
|
@ -69,7 +69,6 @@
|
||||||
that:
|
that:
|
||||||
- "'invocation' in yum_result"
|
- "'invocation' in yum_result"
|
||||||
- "'changed' in yum_result"
|
- "'changed' in yum_result"
|
||||||
- "'item' in yum_result"
|
|
||||||
- "'msg' in yum_result"
|
- "'msg' in yum_result"
|
||||||
- "'rc' in yum_result"
|
- "'rc' in yum_result"
|
||||||
- "'results' in yum_result"
|
- "'results' in yum_result"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue