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
63737008
Commit
63737008
authored
Jan 06, 2013
by
Daniel Hokka Zakrisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip polling when all hosts were skipped
Fixes #1823.
parent
1fa83fa5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
lib/ansible/runner/poller.py
+12
-4
No files found.
lib/ansible/runner/poller.py
View file @
63737008
...
@@ -32,19 +32,23 @@ class AsyncPoller(object):
...
@@ -32,19 +32,23 @@ class AsyncPoller(object):
# Get job id and which hosts to poll again in the future
# Get job id and which hosts to poll again in the future
jid
=
None
jid
=
None
# True to work with & below
skipped
=
True
for
(
host
,
res
)
in
results
[
'contacted'
]
.
iteritems
():
for
(
host
,
res
)
in
results
[
'contacted'
]
.
iteritems
():
if
res
.
get
(
'started'
,
False
):
if
res
.
get
(
'started'
,
False
):
self
.
hosts_to_poll
.
append
(
host
)
self
.
hosts_to_poll
.
append
(
host
)
jid
=
res
.
get
(
'ansible_job_id'
,
None
)
jid
=
res
.
get
(
'ansible_job_id'
,
None
)
else
:
else
:
skipped
=
skipped
&
res
.
get
(
'skipped'
,
False
)
self
.
results
[
'contacted'
][
host
]
=
res
self
.
results
[
'contacted'
][
host
]
=
res
for
(
host
,
res
)
in
results
[
'dark'
]
.
iteritems
():
for
(
host
,
res
)
in
results
[
'dark'
]
.
iteritems
():
self
.
results
[
'dark'
][
host
]
=
res
self
.
results
[
'dark'
][
host
]
=
res
if
jid
is
None
:
if
not
skipped
:
raise
errors
.
AnsibleError
(
"unexpected error: unable to determine jid"
)
if
jid
is
None
:
if
len
(
self
.
hosts_to_poll
)
==
0
:
raise
errors
.
AnsibleError
(
"unexpected error: unable to determine jid"
)
raise
errors
.
AnsibleErrot
(
"unexpected error: no hosts to poll"
)
if
len
(
self
.
hosts_to_poll
)
==
0
:
raise
errors
.
AnsibleErrot
(
"unexpected error: no hosts to poll"
)
self
.
jid
=
jid
self
.
jid
=
jid
def
poll
(
self
):
def
poll
(
self
):
...
@@ -86,6 +90,10 @@ class AsyncPoller(object):
...
@@ -86,6 +90,10 @@ class AsyncPoller(object):
def
wait
(
self
,
seconds
,
poll_interval
):
def
wait
(
self
,
seconds
,
poll_interval
):
""" Wait a certain time for job completion, check status every poll_interval. """
""" Wait a certain time for job completion, check status every poll_interval. """
# jid is None when all hosts were skipped
if
self
.
jid
is
None
:
return
self
.
results
clock
=
seconds
-
poll_interval
clock
=
seconds
-
poll_interval
while
(
clock
>=
0
and
not
self
.
completed
):
while
(
clock
>=
0
and
not
self
.
completed
):
time
.
sleep
(
poll_interval
)
time
.
sleep
(
poll_interval
)
...
...
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