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
0823fb2c
Commit
0823fb2c
authored
Jan 07, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing bug with role paths
parent
fd67a207
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
+13
-12
v2/ansible/playbook/role/definition.py
+10
-9
v2/ansible/playbook/role/include.py
+3
-3
No files found.
v2/ansible/playbook/role/definition.py
View file @
0823fb2c
...
...
@@ -38,9 +38,10 @@ class RoleDefinition(Base, Conditional, Taggable):
_role
=
FieldAttribute
(
isa
=
'string'
)
def
__init__
(
self
,
role_path
=
None
):
self
.
_role_path
=
role_path
self
.
_role_params
=
dict
()
def
__init__
(
self
,
role_basedir
=
None
):
self
.
_role_path
=
None
self
.
_role_basedir
=
role_basedir
self
.
_role_params
=
dict
()
super
(
RoleDefinition
,
self
)
.
__init__
()
def
__repr__
(
self
):
...
...
@@ -112,17 +113,18 @@ class RoleDefinition(Base, Conditional, Taggable):
'''
# FIXME: this should use unfrackpath once the utils code has been sorted out
if
self
.
_role_path
:
role_path
=
self
.
_role_path
else
:
role_path
=
os
.
path
.
normpath
(
role_name
)
role_path
=
os
.
path
.
normpath
(
role_name
)
if
self
.
_loader
.
path_exists
(
role_path
):
role_name
=
os
.
path
.
basename
(
role_name
)
return
(
role_name
,
role_path
)
else
:
# FIXME: this should search in the configured roles path
for
path
in
(
os
.
path
.
join
(
self
.
_loader
.
get_basedir
(),
'roles'
),
'./roles'
,
'/etc/ansible/roles'
):
role_search_paths
=
[
os
.
path
.
join
(
self
.
_loader
.
get_basedir
(),
'roles'
),
'./roles'
,
'/etc/ansible/roles'
]
if
self
.
_role_basedir
:
role_search_paths
=
[
self
.
_role_basedir
]
+
role_search_paths
for
path
in
role_search_paths
:
role_path
=
os
.
path
.
join
(
path
,
role_name
)
if
self
.
_loader
.
path_exists
(
role_path
):
return
(
role_name
,
role_path
)
...
...
@@ -131,7 +133,6 @@ class RoleDefinition(Base, Conditional, Taggable):
# in the yaml so the error line/file can be reported
# here
#import epdb; epdb.st()
raise
AnsibleError
(
"the role '
%
s' was not found"
%
role_name
)
def
_split_role_params
(
self
,
ds
):
...
...
v2/ansible/playbook/role/include.py
View file @
0823fb2c
...
...
@@ -37,13 +37,13 @@ class RoleInclude(RoleDefinition):
FIXME: docstring
"""
def
__init__
(
self
,
role_
path
=
None
):
super
(
RoleInclude
,
self
)
.
__init__
(
role_
path
=
role_path
)
def
__init__
(
self
,
role_
basedir
=
None
):
super
(
RoleInclude
,
self
)
.
__init__
(
role_
basedir
=
role_basedir
)
@staticmethod
def
load
(
data
,
current_role_path
=
None
,
parent_role
=
None
,
variable_manager
=
None
,
loader
=
None
):
assert
isinstance
(
data
,
string_types
)
or
isinstance
(
data
,
dict
)
ri
=
RoleInclude
(
role_
path
=
current_role_path
)
ri
=
RoleInclude
(
role_
basedir
=
current_role_path
)
return
ri
.
load_data
(
data
,
variable_manager
=
variable_manager
,
loader
=
loader
)
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