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
e12b99db
Commit
e12b99db
authored
Aug 15, 2013
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small cleanup, no need to call _get_role_path a second time
parent
9a401e73
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
lib/ansible/playbook/play.py
+10
-12
No files found.
lib/ansible/playbook/play.py
View file @
e12b99db
...
...
@@ -152,10 +152,10 @@ class Play(object):
if
level
>
20
:
raise
errors
.
AnsibleError
(
"too many levels of recursion while resolving role dependencies"
)
for
role
in
roles
:
path
,
role_vars
=
self
.
_get_role_path
(
role
)
role_
path
,
role_vars
=
self
.
_get_role_path
(
role
)
# the meta directory contains the yaml that should
# hold the list of dependencies (if any)
meta
=
self
.
_resolve_main
(
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
path
,
'meta'
)))
meta
=
self
.
_resolve_main
(
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
role_
path
,
'meta'
)))
if
os
.
path
.
isfile
(
meta
):
data
=
utils
.
parse_yaml_from_file
(
meta
)
if
data
:
...
...
@@ -169,11 +169,11 @@ class Play(object):
if
'role'
in
dep_vars
:
del
dep_vars
[
'role'
]
self
.
_build_role_dependencies
([
dep
],
dep_stack
,
vars
=
dep_vars
,
level
=
level
+
1
)
dep_stack
.
append
([
dep
,
dep_vars
])
dep_stack
.
append
([
dep
,
dep_
path
,
dep_
vars
])
# only add the current role when we're at the top level,
# otherwise we'll end up in a recursive loop
if
level
==
0
:
dep_stack
.
append
([
role
,
role_vars
])
dep_stack
.
append
([
role
,
role_
path
,
role_
vars
])
return
dep_stack
def
_load_roles
(
self
,
roles
,
ds
):
...
...
@@ -204,9 +204,7 @@ class Play(object):
roles
=
self
.
_build_role_dependencies
(
roles
,
[],
self
.
vars
)
for
role
,
role_vars
in
roles
:
path
,
ignore
=
self
.
_get_role_path
(
role
)
for
role
,
role_path
,
role_vars
in
roles
:
# special vars must be extracted from the dict to the included tasks
special_keys
=
[
"sudo"
,
"sudo_user"
,
"when"
,
"with_items"
]
special_vars
=
{}
...
...
@@ -214,17 +212,17 @@ class Play(object):
if
k
in
role_vars
:
special_vars
[
k
]
=
role_vars
[
k
]
task_basepath
=
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
path
,
'tasks'
))
handler_basepath
=
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
path
,
'handlers'
))
vars_basepath
=
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
path
,
'vars'
))
task_basepath
=
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
role_
path
,
'tasks'
))
handler_basepath
=
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
role_
path
,
'handlers'
))
vars_basepath
=
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
role_
path
,
'vars'
))
task
=
self
.
_resolve_main
(
task_basepath
)
handler
=
self
.
_resolve_main
(
handler_basepath
)
vars_file
=
self
.
_resolve_main
(
vars_basepath
)
library
=
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
path
,
'library'
))
library
=
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
role_
path
,
'library'
))
if
not
os
.
path
.
isfile
(
task
)
and
not
os
.
path
.
isfile
(
handler
)
and
not
os
.
path
.
isfile
(
vars_file
)
and
not
os
.
path
.
isdir
(
library
):
raise
errors
.
AnsibleError
(
"found role at
%
s, but cannot find
%
s or
%
s or
%
s or
%
s"
%
(
path
,
task
,
handler
,
vars_file
,
library
))
raise
errors
.
AnsibleError
(
"found role at
%
s, but cannot find
%
s or
%
s or
%
s or
%
s"
%
(
role_
path
,
task
,
handler
,
vars_file
,
library
))
if
os
.
path
.
isfile
(
task
):
nt
=
dict
(
include
=
pipes
.
quote
(
task
),
vars
=
role_vars
)
for
k
in
special_keys
:
...
...
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