Skip to content

Commit

Permalink
Expand user home on galaxy install src
Browse files Browse the repository at this point in the history
Fix bug where ansible-galaxy install would fail when given
paths starting with tilde (user home).

Related: ansible/galaxy#2030
  • Loading branch information
ssbarnea committed Nov 3, 2020
1 parent da60525 commit 2a449c6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/70942_galaxy_install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- galaxy - expand ``~`` (user home) from role src (https://github.com/ansible/ansible/pull/70942/).
3 changes: 3 additions & 0 deletions docs/docsite/rst/galaxy/user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ Use the following example as a guide for specifying roles in *requirements.yml*:
# from locally cloned git repository (file:// requires full paths)
- src: file:///home/bennojoy/nginx
# from locally cloned repository
- name: ~/src/bennojoy/nginx
# from GitHub
- src: https://github.com/bennojoy/nginx
Expand Down
3 changes: 2 additions & 1 deletion lib/ansible/galaxy/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from ansible.module_utils.urls import open_url
from ansible.playbook.role.requirement import RoleRequirement
from ansible.utils.display import Display
from ansible.utils.path import unfrackpath

display = Display()

Expand All @@ -64,7 +65,7 @@ def __init__(self, galaxy, api, name, src=None, version=None, scm=None, path=Non

self.name = name
self.version = version
self.src = src or name
self.src = unfrackpath(src or name)
self.scm = scm
self.paths = [os.path.join(x, self.name) for x in galaxy.roles_paths]

Expand Down

0 comments on commit 2a449c6

Please sign in to comment.