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
10575057
Commit
10575057
authored
Dec 18, 2013
by
James Tanner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #5341 Use constants.py to set the roles directory
parent
42d9936b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
bin/ansible-galaxy
+6
-4
lib/ansible/constants.py
+1
-1
No files found.
bin/ansible-galaxy
View file @
10575057
...
...
@@ -37,6 +37,8 @@ from distutils.version import LooseVersion
from
jinja2
import
Environment
from
optparse
import
OptionParser
import
ansible.constants
as
C
default_meta_template
=
"""---
galaxy_info:
author: {{ author }}
...
...
@@ -137,7 +139,7 @@ def build_option_parser(action):
# options that apply to more than one action
if
action
!=
"init"
:
parser
.
add_option
(
'-p'
,
'--roles-path'
,
dest
=
'roles_path'
,
default
=
"/etc/ansible/roles"
,
'-p'
,
'--roles-path'
,
dest
=
'roles_path'
,
default
=
C
.
DEFAULT_ROLES_PATH
,
help
=
'The path to the directory containing your roles.'
'The default is the roles_path configured in your '
'ansible.cfg file (/etc/ansible/roles if not configured)'
)
...
...
@@ -272,7 +274,7 @@ def get_role_path(role_name, options):
Returns the role path based on the roles_path option
and the role name.
"""
roles_path
=
get_opt
(
options
,
'roles_path'
,
'/etc/ansible/roles'
)
roles_path
=
get_opt
(
options
,
'roles_path'
)
return
os
.
path
.
join
(
roles_path
,
role_name
)
def
get_role_metadata
(
role_name
,
options
):
...
...
@@ -280,8 +282,8 @@ def get_role_metadata(role_name, options):
Returns the metadata as YAML, if the file 'meta/main.yml'
exists in the specified role_path
"""
role_path
=
os
.
path
.
join
(
get_role_path
(
role_name
,
options
),
'meta/main.yml'
)
try
:
role_path
=
os
.
path
.
join
(
get_role_path
(
role_name
,
options
),
'meta/main.yml'
)
if
os
.
path
.
isfile
(
role_path
):
f
=
open
(
role_path
,
'r'
)
meta_data
=
yaml
.
safe_load
(
f
)
...
...
@@ -689,7 +691,7 @@ def execute_list(args, options):
print
"The role
%
s was not found"
%
role_name
else
:
# show all valid roles in the roles_path directory
roles_path
=
get_opt
(
options
,
'roles_path'
,
'/etc/ansible/roles'
)
roles_path
=
get_opt
(
options
,
'roles_path'
)
if
not
os
.
path
.
exists
(
roles_path
):
print
"The path
%
s does not exist. Please specify a valid path with --roles-path"
%
roles_path
sys
.
exit
(
1
)
...
...
lib/ansible/constants.py
View file @
10575057
...
...
@@ -100,7 +100,7 @@ DEFAULTS='defaults'
# configurable things
DEFAULT_HOST_LIST
=
shell_expand_path
(
get_config
(
p
,
DEFAULTS
,
'hostfile'
,
'ANSIBLE_HOSTS'
,
'/etc/ansible/hosts'
))
DEFAULT_MODULE_PATH
=
get_config
(
p
,
DEFAULTS
,
'library'
,
'ANSIBLE_LIBRARY'
,
DIST_MODULE_PATH
)
DEFAULT_ROLES_PATH
=
get_config
(
p
,
DEFAULTS
,
'roles_path'
,
'ANSIBLE_ROLES_PATH'
,
None
)
DEFAULT_ROLES_PATH
=
get_config
(
p
,
DEFAULTS
,
'roles_path'
,
'ANSIBLE_ROLES_PATH'
,
'/etc/ansible/roles'
)
DEFAULT_REMOTE_TMP
=
shell_expand_path
(
get_config
(
p
,
DEFAULTS
,
'remote_tmp'
,
'ANSIBLE_REMOTE_TEMP'
,
'$HOME/.ansible/tmp'
))
DEFAULT_MODULE_NAME
=
get_config
(
p
,
DEFAULTS
,
'module_name'
,
None
,
'command'
)
DEFAULT_PATTERN
=
get_config
(
p
,
DEFAULTS
,
'pattern'
,
None
,
'*'
)
...
...
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