Jordan Borean 2 weeks ago committed by GitHub
commit ce7abb2e1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,2 @@
bugfixes:
- gather_facts - Fix up check mode support when ``parallel=true`` - https://github.com/ansible/ansible/issues/82685

@ -133,23 +133,40 @@ class ActionModule(ActionBase):
self._display.vvvv("Running %s" % fact_module)
jobs[fact_module] = (self._execute_module(module_name=fact_module, module_args=mod_args, task_vars=task_vars, wrap_async=True))
while jobs:
for module in jobs:
poll_args = {'jid': jobs[module]['ansible_job_id'], '_async_dir': os.path.dirname(jobs[module]['results_file'])}
res = self._execute_module(module_name='ansible.legacy.async_status', module_args=poll_args, task_vars=task_vars, wrap_async=False)
if res.get('finished', 0) == 1:
if res.get('failed', False):
failed[module] = res
elif res.get('skipped', False):
skipped[module] = res
check_mode = self._task.check_mode
try:
# async_status does not support check mode, this avoids
# that problem for this specific step.
self._task.check_mode = False
while jobs:
for module in jobs:
poll_args = {
'jid': jobs[module]['ansible_job_id'], '_async_dir':
os.path.dirname(jobs[module]['results_file']),
}
res = self._execute_module(
module_name='ansible.legacy.async_status',
module_args=poll_args,
task_vars=task_vars,
wrap_async=False,
)
if res.get('finished', 0) == 1:
if res.get('failed', False):
failed[module] = res
elif res.get('skipped', False):
skipped[module] = res
else:
result = self._combine_task_result(result, res)
del jobs[module]
break
else:
result = self._combine_task_result(result, res)
del jobs[module]
break
time.sleep(0.1)
else:
time.sleep(0.1)
else:
time.sleep(0.5)
time.sleep(0.5)
finally:
self._task.check_mode = check_mode
# restore value for post processing
if self._task.async_val != async_val:

@ -534,3 +534,16 @@
- "{{ output_dir }}/empty_file"
- "{{ output_dir }}/1charsep"
- "{{ output_dir }}/2charsep"
- hosts: facthost1
gather_facts: no
tasks:
- name: check parallel works in check mode
gather_facts:
parallel: true
check_mode: true
- name: assert result of check parallel works in check mode
assert:
that:
- 'ansible_user_id|default("UNDEF_MIN") != "UNDEF_MIN"'

Loading…
Cancel
Save