mirror of https://github.com/ansible/ansible.git
Fix task debugger to work with run_once using linear strategy (#76814)
* Fix task debugger to work with run_once using linear strategy Fixes #76049 * Fix clog * Add integration testpull/76858/head
parent
cad200406a
commit
29de2cccba
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- "Fix task debugger to work with ``run_once`` using ``linear`` strategy (https://github.com/ansible/ansible/issues/76049)"
|
||||
@ -0,0 +1,3 @@
|
||||
shippable/posix/group1
|
||||
context/controller
|
||||
setup/always/setup_pexpect
|
||||
@ -0,0 +1,2 @@
|
||||
testhost ansible_connection=local
|
||||
testhost2 ansible_connection=local
|
||||
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eux
|
||||
|
||||
./test_run_once.py -i inventory "$@"
|
||||
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pexpect
|
||||
|
||||
|
||||
env_vars = {
|
||||
'ANSIBLE_NOCOLOR': 'True',
|
||||
'ANSIBLE_RETRY_FILES_ENABLED': 'False',
|
||||
}
|
||||
|
||||
env = os.environ.copy()
|
||||
env.update(env_vars)
|
||||
|
||||
with io.BytesIO() as logfile:
|
||||
debugger_test_test = pexpect.spawn(
|
||||
'ansible-playbook',
|
||||
args=['test_run_once_playbook.yml'] + sys.argv[1:],
|
||||
timeout=10,
|
||||
env=env
|
||||
)
|
||||
|
||||
debugger_test_test.logfile = logfile
|
||||
|
||||
debugger_test_test.expect_exact('TASK: Task 1 (debug)> ')
|
||||
debugger_test_test.send('task.args["that"] = "true"\r')
|
||||
debugger_test_test.expect_exact('TASK: Task 1 (debug)> ')
|
||||
debugger_test_test.send('r\r')
|
||||
debugger_test_test.expect(pexpect.EOF)
|
||||
debugger_test_test.close()
|
||||
|
||||
assert str(logfile.getvalue()).count('Task 2 executed') == 2
|
||||
@ -0,0 +1,12 @@
|
||||
- hosts: testhost, testhost2
|
||||
gather_facts: false
|
||||
debugger: on_failed
|
||||
tasks:
|
||||
- name: Task 1
|
||||
assert:
|
||||
that: 'false'
|
||||
run_once: yes
|
||||
|
||||
- name: Task 2
|
||||
debug:
|
||||
msg: "Task 2 executed"
|
||||
Loading…
Reference in New Issue