Commit 4803e923 by Will Thames Committed by Michael DeHaan

Improved handling of role_version in repo_url_to_role_name

parent 1803976a
......@@ -356,6 +356,8 @@ def repo_url_to_role_name(repo_url):
trailing_path = repo_url.split('/')[-1]
if trailing_path.endswith('.git'):
trailing_path = trailing_path[:-4]
if ',' in trailing_path:
trailing_path = trailing_path.split(',')[0]
return trailing_path
def json_loads(data):
......
......@@ -780,6 +780,7 @@ class TestUtils(unittest.TestCase):
def test_repo_url_to_role_name(self):
tests = [("http://git.example.com/repos/repo.git", "repo"),
("ssh://git@git.example.com:repos/role-name", "role-name")]
("ssh://git@git.example.com:repos/role-name", "role-name"),
("ssh://git@git.example.com:repos/role-name,v0.1", "role-name")]
for (url, result) in tests:
self.assertEqual(ansible.utils.repo_url_to_role_name(url), result)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment