pause - do not continue with '\r' when timeout is set (#74030)
Original function of pause was, to only allow user input (finished with enter) when no timeout was set. This restores the behaviour.
This commit is contained in:
parent
a84c1a5669
commit
1527078a8f
3 changed files with 32 additions and 13 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- pause - do not accept enter to continue when a timeout is set (https://github.com/ansible/ansible/issues/73948)
|
|
@ -246,6 +246,7 @@ class ActionModule(ActionBase):
|
|||
clear_line(stdout)
|
||||
raise KeyboardInterrupt
|
||||
|
||||
if not seconds:
|
||||
# read key presses and act accordingly
|
||||
if key_pressed in (b'\r', b'\n'):
|
||||
clear_line(stdout)
|
||||
|
|
|
@ -274,3 +274,19 @@ pause_test.send('supersecretpancakes')
|
|||
pause_test.send('\r')
|
||||
pause_test.expect(pexpect.EOF)
|
||||
pause_test.close()
|
||||
|
||||
|
||||
# Test that enter presses may not continue the play when a timeout is set.
|
||||
|
||||
pause_test = pexpect.spawn(
|
||||
'ansible-playbook',
|
||||
args=["pause-3.yml"] + args,
|
||||
timeout=10,
|
||||
env=os.environ
|
||||
)
|
||||
|
||||
pause_test.logfile = log_buffer
|
||||
pause_test.expect(r"\(ctrl\+C then 'C' = continue early, ctrl\+C then 'A' = abort\)")
|
||||
pause_test.send('\r')
|
||||
pause_test.expect(pexpect.EOF)
|
||||
pause_test.close()
|
||||
|
|
Loading…
Add table
Reference in a new issue