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
adb9d7e4
Commit
adb9d7e4
authored
Aug 11, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track role execution per-host, not overall in the role
Fixes #11863 Fixes #11878
parent
fb5003db
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
20 deletions
+14
-20
lib/ansible/executor/play_iterator.py
+2
-2
lib/ansible/playbook/role/__init__.py
+8
-8
lib/ansible/plugins/strategies/__init__.py
+2
-8
lib/ansible/plugins/strategies/free.py
+1
-1
lib/ansible/plugins/strategies/linear.py
+1
-1
No files found.
lib/ansible/executor/play_iterator.py
View file @
adb9d7e4
...
...
@@ -162,8 +162,8 @@ class PlayIterator:
if
task
and
task
.
_role
:
# if we had a current role, mark that role as completed
if
s
.
cur_role
and
task
.
_role
!=
s
.
cur_role
and
s
.
cur_role
.
_had_task_run
and
not
peek
:
s
.
cur_role
.
_completed
=
True
if
s
.
cur_role
and
task
.
_role
!=
s
.
cur_role
and
host
.
name
in
s
.
cur_role
.
_had_task_run
and
not
peek
:
s
.
cur_role
.
_completed
[
host
.
name
]
=
True
s
.
cur_role
=
task
.
_role
if
not
peek
:
...
...
lib/ansible/playbook/role/__init__.py
View file @
adb9d7e4
...
...
@@ -80,8 +80,8 @@ class Role(Base, Become, Conditional, Taggable):
self
.
_handler_blocks
=
[]
self
.
_default_vars
=
dict
()
self
.
_role_vars
=
dict
()
self
.
_had_task_run
=
False
self
.
_completed
=
False
self
.
_had_task_run
=
dict
()
self
.
_completed
=
dict
()
super
(
Role
,
self
)
.
__init__
()
...
...
@@ -303,13 +303,13 @@ class Role(Base, Become, Conditional, Taggable):
block_list
.
extend
(
self
.
_handler_blocks
)
return
block_list
def
has_run
(
self
):
def
has_run
(
self
,
host
):
'''
Returns true if this role has been iterated over completely and
at least one task was run
'''
return
self
.
_had_task_run
and
self
.
_completed
and
not
self
.
_metadata
.
allow_duplicates
return
host
.
name
in
self
.
_completed
and
not
self
.
_metadata
.
allow_duplicates
def
compile
(
self
,
play
,
dep_chain
=
[]):
'''
...
...
@@ -348,8 +348,8 @@ class Role(Base, Become, Conditional, Taggable):
res
[
'_role_vars'
]
=
self
.
_role_vars
res
[
'_role_params'
]
=
self
.
_role_params
res
[
'_default_vars'
]
=
self
.
_default_vars
res
[
'_had_task_run'
]
=
self
.
_had_task_run
res
[
'_completed'
]
=
self
.
_completed
res
[
'_had_task_run'
]
=
self
.
_had_task_run
.
copy
()
res
[
'_completed'
]
=
self
.
_completed
.
copy
()
if
self
.
_metadata
:
res
[
'_metadata'
]
=
self
.
_metadata
.
serialize
()
...
...
@@ -373,8 +373,8 @@ class Role(Base, Become, Conditional, Taggable):
self
.
_role_vars
=
data
.
get
(
'_role_vars'
,
dict
())
self
.
_role_params
=
data
.
get
(
'_role_params'
,
dict
())
self
.
_default_vars
=
data
.
get
(
'_default_vars'
,
dict
())
self
.
_had_task_run
=
data
.
get
(
'_had_task_run'
,
False
)
self
.
_completed
=
data
.
get
(
'_completed'
,
False
)
self
.
_had_task_run
=
data
.
get
(
'_had_task_run'
,
dict
()
)
self
.
_completed
=
data
.
get
(
'_completed'
,
dict
()
)
if
include_deps
:
deps
=
[]
...
...
lib/ansible/plugins/strategies/__init__.py
View file @
adb9d7e4
...
...
@@ -205,14 +205,8 @@ class StrategyBase:
# lookup the role in the ROLE_CACHE to make sure we're dealing
# with the correct object and mark it as executed
for
(
entry
,
role_obj
)
in
iterator
.
_play
.
ROLE_CACHE
[
task_result
.
_task
.
_role
.
_role_name
]
.
iteritems
():
params
=
task_result
.
_task
.
_role
.
_role_params
if
task_result
.
_task
.
_role
.
tags
is
not
None
:
params
[
'tags'
]
=
task_result
.
_task
.
_role
.
tags
if
task_result
.
_task
.
_role
.
when
is
not
None
:
params
[
'when'
]
=
task_result
.
_task
.
_role
.
when
hashed_entry
=
hash_params
(
params
)
if
entry
==
hashed_entry
:
role_obj
.
_had_task_run
=
True
if
role_obj
.
_uuid
==
task_result
.
_task
.
_role
.
_uuid
:
role_obj
.
_had_task_run
[
host
.
name
]
=
True
ret_results
.
append
(
task_result
)
...
...
lib/ansible/plugins/strategies/free.py
View file @
adb9d7e4
...
...
@@ -97,7 +97,7 @@ class StrategyModule(StrategyBase):
# check to see if this task should be skipped, due to it being a member of a
# role which has already run (and whether that role allows duplicate execution)
if
task
.
_role
and
task
.
_role
.
has_run
():
if
task
.
_role
and
task
.
_role
.
has_run
(
host
):
# If there is no metadata, the default behavior is to not allow duplicates,
# if there is metadata, check to see if the allow_duplicates flag was set to true
if
task
.
_role
.
_metadata
is
None
or
task
.
_role
.
_metadata
and
not
task
.
_role
.
_metadata
.
allow_duplicates
:
...
...
lib/ansible/plugins/strategies/linear.py
View file @
adb9d7e4
...
...
@@ -170,7 +170,7 @@ class StrategyModule(StrategyBase):
# check to see if this task should be skipped, due to it being a member of a
# role which has already run (and whether that role allows duplicate execution)
if
task
.
_role
and
task
.
_role
.
has_run
():
if
task
.
_role
and
task
.
_role
.
has_run
(
host
):
# If there is no metadata, the default behavior is to not allow duplicates,
# if there is metadata, check to see if the allow_duplicates flag was set to true
if
task
.
_role
.
_metadata
is
None
or
task
.
_role
.
_metadata
and
not
task
.
_role
.
_metadata
.
allow_duplicates
:
...
...
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