Tidied up a little, added tests

Moved repo_url_to_role_name to common method in ansible.utils
Added unit test for repo_url_to_role_name
Added integration tests for galaxy
This commit is contained in:
Will Thames 2014-08-14 20:20:10 +10:00 committed by Michael DeHaan
commit c2fe33f9f4
7 changed files with 38 additions and 7 deletions

View file

@ -352,6 +352,12 @@ def path_dwim_relative(original, dirname, source, playbook_base, check=True):
raise errors.AnsibleError("input file not found at %s or %s" % (source2, obvious_local_path))
return source2 # which does not exist
def repo_url_to_role_name(repo_url):
trailing_path = repo_url.split('/')[-1]
if trailing_path.endswith('.git'):
trailing_path = trailing_path[:-4]
return trailing_path
def json_loads(data):
''' parse a JSON string and return a data structure '''