Skip to content

Commit

Permalink
Merge branch 'galaxy_github_archive' of git://github.com/willthames/a…
Browse files Browse the repository at this point in the history
…nsible into devel

Conflicts:
	lib/ansible/utils/__init__.py
  • Loading branch information
Michael DeHaan committed Aug 22, 2014
2 parents 311ec54 + 8509637 commit d87830e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
9 changes: 4 additions & 5 deletions lib/ansible/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,11 @@ def role_spec_parse(role_spec):
if role_spec == "" or role_spec.startswith("#"):
return (None, None, None, None)

# FIXME: coding guidelines want this as a list comprehension
tokens = map(lambda s: s.strip(), role_spec.split(','))
tokens = [s.strip() for s in role_spec.split(',')]

# assume https://github.com URLs are git+https:// URLs and not
# tarballs
if 'github.com/' in tokens[0] and not tokens[0].startswith("git+"):
# tarballs unless they end in '.zip'
if 'github.com/' in tokens[0] and not tokens[0].startswith("git+") and not tokens[0].endswith('.tar.gz'):
tokens[0] = 'git+' + tokens[0]

if '+' in tokens[0]:
Expand All @@ -408,7 +407,7 @@ def role_spec_parse(role_spec):


def role_yaml_parse(role):
if 'github.com' in role["src"] and 'http' in role["src"] and '+' not in role["src"]:
if 'github.com' in role["src"] and 'http' in role["src"] and '+' not in role["src"] and not role["src"].endswith('.tar.gz'):
role["src"] = "git+" + role["src"]
if '+' in role["src"]:
(scm, src) = role["src"].split('+')
Expand Down
12 changes: 11 additions & 1 deletion test/units/TestUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,14 +824,24 @@ def test_role_spec_parse(self):
}
),
(
# test that http://github URLs are assumed git+http://
# test that http://github URLs are assumed git+http:// unless they end in .tar.gz
"http://github.com/ansible/fakerole/fake",
{
'scm' : 'git',
'src' : 'http://github.com/ansible/fakerole/fake',
'version' : '',
'name' : 'fake'
}
),
(
# test that http://github URLs are assumed git+http:// unless they end in .tar.gz
"http://github.com/ansible/fakerole/fake/archive/master.tar.gz",
{
'scm' : None,
'src' : 'http://github.com/ansible/fakerole/fake/archive/master.tar.gz',
'version' : '',
'name' : 'master'
}
)
]
for (spec, result) in tests:
Expand Down

0 comments on commit d87830e

Please sign in to comment.