Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
dc80bc89
Commit
dc80bc89
authored
Aug 06, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
now pause behaves like v1 pause
parent
f7707d88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
19 deletions
+21
-19
lib/ansible/plugins/action/pause.py
+21
-19
No files found.
lib/ansible/plugins/action/pause.py
View file @
dc80bc89
...
...
@@ -110,32 +110,35 @@ class ActionModule(ActionBase):
tty
.
setraw
(
fd
)
# flush the buffer to make sure no previous key presses
# are read in below
# are read in below
termios
.
tcflush
(
self
.
_connection
.
_new_stdin
,
termios
.
TCIFLUSH
)
# read key presses and act accordingly
while
True
:
key_pressed
=
self
.
_connection
.
_new_stdin
.
read
(
1
)
if
pause_type
in
(
'minutes'
,
'seconds'
):
if
key_pressed
==
'
\x03
'
:
try
:
if
seconds
:
key_pressed
=
self
.
_connection
.
_new_stdin
.
read
(
1
)
if
key_pressed
==
'
a
'
:
if
key_pressed
==
'
\x03
'
:
raise
KeyboardInterrupt
elif
key_pressed
==
'c'
:
else
:
# read key presses and act accordingly
key_pressed
=
self
.
_connection
.
_new_stdin
.
read
(
1
)
if
key_pressed
==
'
\x03
'
:
raise
KeyboardInterrupt
elif
key_pressed
==
'
\r
'
:
break
else
:
if
key_pressed
==
'
\x03
'
:
raise
KeyboardInterrupt
elif
key_pressed
==
'
\r
'
:
else
:
result
[
'user_input'
]
+=
key_pressed
except
KeyboardInterrupt
:
if
seconds
is
not
None
:
signal
.
alarm
(
0
)
self
.
_display
.
display
(
"Press 'C' to continue the play or 'A' to abort
\r
"
),
key_pressed
=
self
.
_connection
.
_new_stdin
.
read
(
1
)
if
key_pressed
.
lower
()
==
'a'
:
raise
AnsibleError
(
'user requested abort!'
)
elif
key_pressed
.
lower
()
==
'c'
:
break
else
:
result
[
'user_input'
]
+=
key_pressed
except
KeyboardInterrupt
:
# cancel the previously set alarm signal
if
seconds
is
not
None
:
signal
.
alarm
(
0
)
raise
AnsibleError
(
'user requested abort!'
)
except
AnsibleTimeoutExceeded
:
# this is the exception we expect when the alarm signal
# fires, so we simply ignore it to move into the cleanup
...
...
@@ -153,7 +156,6 @@ class ActionModule(ActionBase):
duration
=
round
(
duration
/
60.0
,
2
)
else
:
duration
=
round
(
duration
,
2
)
result
[
'stdout'
]
=
"Paused for
%
s
%
s"
%
(
duration
,
duration_unit
)
return
result
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment