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
271a7f32
Commit
271a7f32
authored
Jul 17, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaning up some of the notify/facts logic added earlier to fix problems
parent
1aa41552
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
14 deletions
+14
-14
lib/ansible/executor/process/result.py
+11
-10
lib/ansible/executor/task_executor.py
+1
-1
lib/ansible/plugins/action/normal.py
+1
-1
lib/ansible/plugins/strategies/__init__.py
+1
-2
No files found.
lib/ansible/executor/process/result.py
View file @
271a7f32
...
@@ -131,16 +131,17 @@ class ResultProcess(multiprocessing.Process):
...
@@ -131,16 +131,17 @@ class ResultProcess(multiprocessing.Process):
for
result_item
in
result_items
:
for
result_item
in
result_items
:
# if this task is notifying a handler, do it now
# if this task is notifying a handler, do it now
if
'ansible_notify'
in
result_item
and
result
.
is_changed
():
if
'ansible_notify'
in
result_item
:
# The shared dictionary for notified handlers is a proxy, which
if
result
.
is_changed
():
# does not detect when sub-objects within the proxy are modified.
# The shared dictionary for notified handlers is a proxy, which
# So, per the docs, we reassign the list so the proxy picks up and
# does not detect when sub-objects within the proxy are modified.
# notifies all other threads
# So, per the docs, we reassign the list so the proxy picks up and
for
notify
in
result_item
[
'ansible_notify'
]:
# notifies all other threads
if
result
.
_task
.
_role
:
for
notify
in
result_item
[
'ansible_notify'
]:
role_name
=
result
.
_task
.
_role
.
get_name
()
if
result
.
_task
.
_role
:
notify
=
"
%
s :
%
s"
%
(
role_name
,
notify
)
role_name
=
result
.
_task
.
_role
.
get_name
()
self
.
_send_result
((
'notify_handler'
,
result
.
_host
,
notify
))
notify
=
"
%
s :
%
s"
%
(
role_name
,
notify
)
self
.
_send_result
((
'notify_handler'
,
result
.
_host
,
notify
))
# now remove the notify field from the results, as its no longer needed
# now remove the notify field from the results, as its no longer needed
result_item
.
pop
(
'ansible_notify'
)
result_item
.
pop
(
'ansible_notify'
)
...
...
lib/ansible/executor/task_executor.py
View file @
271a7f32
...
@@ -333,7 +333,7 @@ class TaskExecutor:
...
@@ -333,7 +333,7 @@ class TaskExecutor:
# save the notification target in the result, if it was specified, as
# save the notification target in the result, if it was specified, as
# this task may be running in a loop in which case the notification
# this task may be running in a loop in which case the notification
# may be item-specific, ie. "notify: service {{item}}"
# may be item-specific, ie. "notify: service {{item}}"
if
self
.
_task
.
notify
:
if
self
.
_task
.
notify
is
not
None
:
result
[
'ansible_notify'
]
=
self
.
_task
.
notify
result
[
'ansible_notify'
]
=
self
.
_task
.
notify
# and return
# and return
...
...
lib/ansible/plugins/action/normal.py
View file @
271a7f32
...
@@ -28,7 +28,7 @@ class ActionModule(ActionBase):
...
@@ -28,7 +28,7 @@ class ActionModule(ActionBase):
# Remove special fields from the result, which can only be set
# Remove special fields from the result, which can only be set
# internally by the executor engine. We do this only here in
# internally by the executor engine. We do this only here in
# the 'normal' action, as other action plugins may set this.
# the 'normal' action, as other action plugins may set this.
for
field
in
(
'ansible_
facts'
,
'ansible_notify'
):
for
field
in
(
'ansible_
notify'
,
):
if
field
in
results
:
if
field
in
results
:
results
.
pop
(
field
)
results
.
pop
(
field
)
...
...
lib/ansible/plugins/strategies/__init__.py
View file @
271a7f32
...
@@ -213,7 +213,6 @@ class StrategyBase:
...
@@ -213,7 +213,6 @@ class StrategyBase:
elif
result
[
0
]
==
'notify_handler'
:
elif
result
[
0
]
==
'notify_handler'
:
host
=
result
[
1
]
host
=
result
[
1
]
handler_name
=
result
[
2
]
handler_name
=
result
[
2
]
if
handler_name
not
in
self
.
_notified_handlers
:
if
handler_name
not
in
self
.
_notified_handlers
:
self
.
_notified_handlers
[
handler_name
]
=
[]
self
.
_notified_handlers
[
handler_name
]
=
[]
...
@@ -425,7 +424,7 @@ class StrategyBase:
...
@@ -425,7 +424,7 @@ class StrategyBase:
task_vars
=
self
.
_variable_manager
.
get_vars
(
loader
=
self
.
_loader
,
play
=
iterator
.
_play
,
host
=
host
,
task
=
handler
)
task_vars
=
self
.
_variable_manager
.
get_vars
(
loader
=
self
.
_loader
,
play
=
iterator
.
_play
,
host
=
host
,
task
=
handler
)
task_vars
=
self
.
add_tqm_variables
(
task_vars
,
play
=
iterator
.
_play
)
task_vars
=
self
.
add_tqm_variables
(
task_vars
,
play
=
iterator
.
_play
)
self
.
_queue_task
(
host
,
handler
,
task_vars
,
connection_info
)
self
.
_queue_task
(
host
,
handler
,
task_vars
,
connection_info
)
handler
.
flag_for_host
(
host
)
#
handler.flag_for_host(host)
self
.
_process_pending_results
(
iterator
)
self
.
_process_pending_results
(
iterator
)
self
.
_wait_on_pending_results
(
iterator
)
self
.
_wait_on_pending_results
(
iterator
)
# wipe the notification list
# wipe the notification list
...
...
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