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
08ad05c8
Commit
08ad05c8
authored
Jul 02, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure callbacks are loaded in the tqm a bit earlier
Fixes #11463
parent
1b74102a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
15 deletions
+12
-15
lib/ansible/executor/playbook_executor.py
+3
-0
lib/ansible/executor/task_queue_manager.py
+9
-15
No files found.
lib/ansible/executor/playbook_executor.py
View file @
08ad05c8
...
...
@@ -122,6 +122,9 @@ class PlaybookExecutor:
entry
[
'plays'
]
.
append
(
p
)
else
:
# make sure the tqm has callbacks loaded
self
.
_tqm
.
load_callbacks
()
# we are actually running plays
for
batch
in
self
.
_get_serialized_batches
(
new_play
):
if
len
(
batch
)
==
0
:
...
...
lib/ansible/executor/task_queue_manager.py
View file @
08ad05c8
...
...
@@ -61,6 +61,7 @@ class TaskQueueManager:
self
.
_stats
=
AggregateStats
()
self
.
passwords
=
passwords
self
.
_stdout_callback
=
stdout_callback
self
.
_callback_plugins
=
[]
# a special flag to help us exit cleanly
self
.
_terminated
=
False
...
...
@@ -115,21 +116,19 @@ class TaskQueueManager:
for
handler
in
handler_list
:
self
.
_notified_handlers
[
handler
.
get_name
()]
=
[]
def
_load_callbacks
(
self
,
stdout_callback
):
def
load_callbacks
(
self
):
'''
Loads all available callbacks, with the exception of those which
utilize the CALLBACK_TYPE option. When CALLBACK_TYPE is set to 'stdout',
only one such callback plugin will be loaded.
'''
loaded_plugins
=
[]
stdout_callback_loaded
=
False
if
stdout_callback
is
None
:
stdout_callback
=
C
.
DEFAULT_STDOUT_CALLBACK
if
s
elf
.
_s
tdout_callback
is
None
:
s
elf
.
_s
tdout_callback
=
C
.
DEFAULT_STDOUT_CALLBACK
if
stdout_callback
not
in
callback_loader
:
raise
AnsibleError
(
"Invalid callback for stdout specified:
%
s"
%
stdout_callback
)
if
s
elf
.
_s
tdout_callback
not
in
callback_loader
:
raise
AnsibleError
(
"Invalid callback for stdout specified:
%
s"
%
s
elf
.
_s
tdout_callback
)
for
callback_plugin
in
callback_loader
.
all
(
class_only
=
True
):
if
hasattr
(
callback_plugin
,
'CALLBACK_VERSION'
)
and
callback_plugin
.
CALLBACK_VERSION
>=
2.0
:
...
...
@@ -139,17 +138,15 @@ class TaskQueueManager:
callback_type
=
getattr
(
callback_plugin
,
'CALLBACK_TYPE'
,
None
)
(
callback_name
,
_
)
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
callback_plugin
.
_original_path
))
if
callback_type
==
'stdout'
:
if
callback_name
!=
stdout_callback
or
stdout_callback_loaded
:
if
callback_name
!=
s
elf
.
_s
tdout_callback
or
stdout_callback_loaded
:
continue
stdout_callback_loaded
=
True
elif
C
.
DEFAULT_CALLBACK_WHITELIST
is
None
or
callback_name
not
in
C
.
DEFAULT_CALLBACK_WHITELIST
:
continue
loaded
_plugins
.
append
(
callback_plugin
(
self
.
_display
))
self
.
_callback
_plugins
.
append
(
callback_plugin
(
self
.
_display
))
else
:
loaded_plugins
.
append
(
callback_plugin
())
return
loaded_plugins
self
.
_callback_plugins
.
append
(
callback_plugin
())
def
_do_var_prompt
(
self
,
varname
,
private
=
True
,
prompt
=
None
,
encrypt
=
None
,
confirm
=
False
,
salt_size
=
None
,
salt
=
None
,
default
=
None
):
...
...
@@ -204,9 +201,6 @@ class TaskQueueManager:
are done with the current task).
'''
# load callback plugins
self
.
_callback_plugins
=
self
.
_load_callbacks
(
self
.
_stdout_callback
)
if
play
.
vars_prompt
:
for
var
in
play
.
vars_prompt
:
if
'name'
not
in
var
:
...
...
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