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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
lib/ansible/plugins/action/pause.py
+10
-8
No files found.
lib/ansible/plugins/action/pause.py
View file @
dc80bc89
...
@@ -113,17 +113,15 @@ class ActionModule(ActionBase):
...
@@ -113,17 +113,15 @@ class ActionModule(ActionBase):
# are read in below
# are read in below
termios
.
tcflush
(
self
.
_connection
.
_new_stdin
,
termios
.
TCIFLUSH
)
termios
.
tcflush
(
self
.
_connection
.
_new_stdin
,
termios
.
TCIFLUSH
)
# read key presses and act accordingly
while
True
:
while
True
:
try
:
if
seconds
:
key_pressed
=
self
.
_connection
.
_new_stdin
.
read
(
1
)
key_pressed
=
self
.
_connection
.
_new_stdin
.
read
(
1
)
if
pause_type
in
(
'minutes'
,
'seconds'
):
if
key_pressed
==
'
\x03
'
:
if
key_pressed
==
'
\x03
'
:
key_pressed
=
self
.
_connection
.
_new_stdin
.
read
(
1
)
if
key_pressed
==
'a'
:
raise
KeyboardInterrupt
raise
KeyboardInterrupt
elif
key_pressed
==
'c'
:
break
else
:
else
:
# read key presses and act accordingly
key_pressed
=
self
.
_connection
.
_new_stdin
.
read
(
1
)
if
key_pressed
==
'
\x03
'
:
if
key_pressed
==
'
\x03
'
:
raise
KeyboardInterrupt
raise
KeyboardInterrupt
elif
key_pressed
==
'
\r
'
:
elif
key_pressed
==
'
\r
'
:
...
@@ -132,10 +130,15 @@ class ActionModule(ActionBase):
...
@@ -132,10 +130,15 @@ class ActionModule(ActionBase):
result
[
'user_input'
]
+=
key_pressed
result
[
'user_input'
]
+=
key_pressed
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
# cancel the previously set alarm signal
if
seconds
is
not
None
:
if
seconds
is
not
None
:
signal
.
alarm
(
0
)
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!'
)
raise
AnsibleError
(
'user requested abort!'
)
elif
key_pressed
.
lower
()
==
'c'
:
break
except
AnsibleTimeoutExceeded
:
except
AnsibleTimeoutExceeded
:
# this is the exception we expect when the alarm signal
# this is the exception we expect when the alarm signal
# fires, so we simply ignore it to move into the cleanup
# fires, so we simply ignore it to move into the cleanup
...
@@ -153,7 +156,6 @@ class ActionModule(ActionBase):
...
@@ -153,7 +156,6 @@ class ActionModule(ActionBase):
duration
=
round
(
duration
/
60.0
,
2
)
duration
=
round
(
duration
/
60.0
,
2
)
else
:
else
:
duration
=
round
(
duration
,
2
)
duration
=
round
(
duration
,
2
)
result
[
'stdout'
]
=
"Paused for
%
s
%
s"
%
(
duration
,
duration_unit
)
result
[
'stdout'
]
=
"Paused for
%
s
%
s"
%
(
duration
,
duration_unit
)
return
result
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