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
2e5dfd57
Commit
2e5dfd57
authored
Jul 07, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clear flag indicating role had run before each play is run
Fixes #11514
parent
48827a31
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
+11
-2
lib/ansible/executor/playbook_executor.py
+5
-0
lib/ansible/playbook/role/__init__.py
+5
-1
lib/ansible/plugins/strategies/__init__.py
+1
-1
No files found.
lib/ansible/executor/playbook_executor.py
View file @
2e5dfd57
...
@@ -25,6 +25,7 @@ from ansible import constants as C
...
@@ -25,6 +25,7 @@ from ansible import constants as C
from
ansible.errors
import
*
from
ansible.errors
import
*
from
ansible.executor.task_queue_manager
import
TaskQueueManager
from
ansible.executor.task_queue_manager
import
TaskQueueManager
from
ansible.playbook
import
Playbook
from
ansible.playbook
import
Playbook
from
ansible.playbook.role
import
role_reset_has_run
from
ansible.plugins
import
module_loader
from
ansible.plugins
import
module_loader
from
ansible.template
import
Templar
from
ansible.template
import
Templar
...
@@ -83,6 +84,10 @@ class PlaybookExecutor:
...
@@ -83,6 +84,10 @@ class PlaybookExecutor:
self
.
_display
.
vv
(
'
%
d plays in
%
s'
%
(
len
(
plays
),
playbook_path
))
self
.
_display
.
vv
(
'
%
d plays in
%
s'
%
(
len
(
plays
),
playbook_path
))
for
play
in
plays
:
for
play
in
plays
:
# clear out the flag on all roles indicating they had any tasks run
role_reset_has_run
()
# clear any filters which may have been applied to the inventory
self
.
_inventory
.
remove_restriction
()
self
.
_inventory
.
remove_restriction
()
# Create a temporary copy of the play here, so we can run post_validate
# Create a temporary copy of the play here, so we can run post_validate
...
...
lib/ansible/playbook/role/__init__.py
View file @
2e5dfd57
...
@@ -41,7 +41,7 @@ from ansible.plugins import get_all_plugin_loaders, push_basedir
...
@@ -41,7 +41,7 @@ from ansible.plugins import get_all_plugin_loaders, push_basedir
from
ansible.utils.vars
import
combine_vars
from
ansible.utils.vars
import
combine_vars
__all__
=
[
'Role'
,
'ROLE_CACHE'
,
'hash_params'
]
__all__
=
[
'Role'
,
'ROLE_CACHE'
,
'hash_params'
,
'role_reset_has_run'
]
# FIXME: this should be a utility function, but can't be a member of
# FIXME: this should be a utility function, but can't be a member of
# the role due to the fact that it would require the use of self
# the role due to the fact that it would require the use of self
...
@@ -70,6 +70,10 @@ def hash_params(params):
...
@@ -70,6 +70,10 @@ def hash_params(params):
# will be based on the repr() of the dictionary object)
# will be based on the repr() of the dictionary object)
ROLE_CACHE
=
dict
()
ROLE_CACHE
=
dict
()
def
role_reset_has_run
():
for
(
role_name
,
cached_roles
)
in
ROLE_CACHE
.
iteritems
():
for
(
hashed_params
,
role
)
in
cached_roles
.
iteritems
():
role
.
_had_task_run
=
False
class
Role
(
Base
,
Become
,
Conditional
,
Taggable
):
class
Role
(
Base
,
Become
,
Conditional
,
Taggable
):
...
...
lib/ansible/plugins/strategies/__init__.py
View file @
2e5dfd57
...
@@ -195,7 +195,7 @@ class StrategyBase:
...
@@ -195,7 +195,7 @@ class StrategyBase:
# with the correct object and mark it as executed
# with the correct object and mark it as executed
for
(
entry
,
role_obj
)
in
ROLE_CACHE
[
task_result
.
_task
.
_role
.
_role_name
]
.
iteritems
():
for
(
entry
,
role_obj
)
in
ROLE_CACHE
[
task_result
.
_task
.
_role
.
_role_name
]
.
iteritems
():
hashed_entry
=
hash_params
(
task_result
.
_task
.
_role
.
_role_params
)
hashed_entry
=
hash_params
(
task_result
.
_task
.
_role
.
_role_params
)
if
entry
==
hashed_entry
:
if
entry
==
hashed_entry
:
role_obj
.
_had_task_run
=
True
role_obj
.
_had_task_run
=
True
ret_results
.
append
(
task_result
)
ret_results
.
append
(
task_result
)
...
...
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