...
|
...
|
@@ -275,7 +275,9 @@ def get_role_path(role_name, options):
|
275
|
275
|
and the role name.
|
276
|
276
|
"""
|
277
|
277
|
roles_path = get_opt(options,'roles_path')
|
278
|
|
- return os.path.join(roles_path, role_name)
|
|
278
|
+ roles_path = os.path.join(roles_path, role_name)
|
|
279
|
+ roles_path = os.path.expanduser(roles_path)
|
|
280
|
+ return roles_path
|
279
|
281
|
|
280
|
282
|
def get_role_metadata(role_name, options):
|
281
|
283
|
"""
|
...
|
...
|
@@ -340,7 +342,8 @@ def remove_role(role_name, options):
|
340
|
340
|
path so the user doesn't blow away random directories
|
341
|
341
|
"""
|
342
|
342
|
if get_role_metadata(role_name, options):
|
343
|
|
- shutil.rmtree(get_role_path(role_name, options))
|
|
343
|
+ role_path = get_role_path(role_name, options)
|
|
344
|
+ shutil.rmtree(role_path)
|
344
|
345
|
return True
|
345
|
346
|
else:
|
346
|
347
|
return False
|
...
|
...
|
@@ -399,6 +402,7 @@ def install_role(role_name, role_version, role_filename, options):
|
399
|
399
|
# the tar file here, since the default is 'github_repo-target', and change it
|
400
|
400
|
# to the specified role's name
|
401
|
401
|
role_path = os.path.join(get_opt(options, 'roles_path', '/etc/ansible/roles'), role_name)
|
|
402
|
+ role_path = os.path.expanduser(role_path)
|
402
|
403
|
print " - extracting %s to %s" % (role_name, role_path)
|
403
|
404
|
try:
|
404
|
405
|
if os.path.exists(role_path):
|
...
|
...
|
@@ -692,6 +696,7 @@ def execute_list(args, options):
|
692
|
692
|
else:
|
693
|
693
|
# show all valid roles in the roles_path directory
|
694
|
694
|
roles_path = get_opt(options, 'roles_path')
|
|
695
|
+ roles_path = os.path.expanduser(roles_path)
|
695
|
696
|
if not os.path.exists(roles_path):
|
696
|
697
|
print "The path %s does not exist. Please specify a valid path with --roles-path" % roles_path
|
697
|
698
|
sys.exit(1)
|