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
be81b650
Commit
be81b650
authored
Jun 20, 2015
by
Benno Joy
Committed by
James Cammarata
Jun 21, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes issue 11286 where role handlers are not run
parent
6e61881e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
1 deletions
+21
-1
lib/ansible/executor/play_iterator.py
+3
-0
lib/ansible/executor/process/result.py
+3
-0
lib/ansible/playbook/play.py
+14
-0
lib/ansible/playbook/role/__init__.py
+1
-1
No files found.
lib/ansible/executor/play_iterator.py
View file @
be81b650
...
@@ -100,6 +100,9 @@ class PlayIterator:
...
@@ -100,6 +100,9 @@ class PlayIterator:
for
host
in
inventory
.
get_hosts
(
self
.
_play
.
hosts
):
for
host
in
inventory
.
get_hosts
(
self
.
_play
.
hosts
):
self
.
_host_states
[
host
.
name
]
=
HostState
(
blocks
=
self
.
_blocks
)
self
.
_host_states
[
host
.
name
]
=
HostState
(
blocks
=
self
.
_blocks
)
# Extend the play handlers list to include the handlers defined in roles
self
.
_play
.
handlers
.
extend
(
play
.
compile_roles_handlers
())
def
get_host_state
(
self
,
host
):
def
get_host_state
(
self
,
host
):
try
:
try
:
return
self
.
_host_states
[
host
.
name
]
.
copy
()
return
self
.
_host_states
[
host
.
name
]
.
copy
()
...
...
lib/ansible/executor/process/result.py
View file @
be81b650
...
@@ -129,6 +129,9 @@ class ResultProcess(multiprocessing.Process):
...
@@ -129,6 +129,9 @@ class ResultProcess(multiprocessing.Process):
# So, per the docs, we reassign the list so the proxy picks up and
# So, per the docs, we reassign the list so the proxy picks up and
# notifies all other threads
# notifies all other threads
for
notify
in
result
.
_task
.
notify
:
for
notify
in
result
.
_task
.
notify
:
if
result
.
_task
.
_role
:
role_name
=
result
.
_task
.
_role
.
get_name
()
notify
=
"
%
s :
%
s"
%
(
role_name
,
notify
)
self
.
_send_result
((
'notify_handler'
,
result
.
_host
,
notify
))
self
.
_send_result
((
'notify_handler'
,
result
.
_host
,
notify
))
if
result
.
_task
.
loop
:
if
result
.
_task
.
loop
:
...
...
lib/ansible/playbook/play.py
View file @
be81b650
...
@@ -206,6 +206,20 @@ class Play(Base, Taggable, Become):
...
@@ -206,6 +206,20 @@ class Play(Base, Taggable, Become):
return
block_list
return
block_list
def
compile_roles_handlers
(
self
):
'''
Handles the role handler compilation step, returning a flat list of Handlers
This is done for all roles in the Play.
'''
block_list
=
[]
if
len
(
self
.
roles
)
>
0
:
for
r
in
self
.
roles
:
block_list
.
extend
(
r
.
get_handler_blocks
())
return
block_list
def
compile
(
self
):
def
compile
(
self
):
'''
'''
Compiles and returns the task list for this play, compiled from the
Compiles and returns the task list for this play, compiled from the
...
...
lib/ansible/playbook/role/__init__.py
View file @
be81b650
...
@@ -172,7 +172,7 @@ class Role(Base, Become, Conditional, Taggable):
...
@@ -172,7 +172,7 @@ class Role(Base, Become, Conditional, Taggable):
handler_data
=
self
.
_load_role_yaml
(
'handlers'
)
handler_data
=
self
.
_load_role_yaml
(
'handlers'
)
if
handler_data
:
if
handler_data
:
self
.
_handler_blocks
=
load_list_of_blocks
(
handler_data
,
play
=
None
,
role
=
self
,
loader
=
self
.
_loader
)
self
.
_handler_blocks
=
load_list_of_blocks
(
handler_data
,
play
=
None
,
role
=
self
,
use_handlers
=
True
,
loader
=
self
.
_loader
)
# vars and default vars are regular dictionaries
# vars and default vars are regular dictionaries
self
.
_role_vars
=
self
.
_load_role_yaml
(
'vars'
)
self
.
_role_vars
=
self
.
_load_role_yaml
(
'vars'
)
...
...
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