1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge branch 'galaxy_github_archive' of git://github.com/willthames/ansible into devel

Conflicts:
	lib/ansible/utils/__init__.py
This commit is contained in:
Michael DeHaan 2014-08-22 13:58:50 -04:00
commit d87830e1cc
2 changed files with 15 additions and 6 deletions

View file

@ -385,12 +385,11 @@ def role_spec_parse(role_spec):
if role_spec == "" or role_spec.startswith("#"): if role_spec == "" or role_spec.startswith("#"):
return (None, None, None, None) return (None, None, None, None)
# FIXME: coding guidelines want this as a list comprehension tokens = [s.strip() for s in role_spec.split(',')]
tokens = map(lambda s: s.strip(), role_spec.split(','))
# assume https://github.com URLs are git+https:// URLs and not # assume https://github.com URLs are git+https:// URLs and not
# tarballs # tarballs unless they end in '.zip'
if 'github.com/' in tokens[0] and not tokens[0].startswith("git+"): if 'github.com/' in tokens[0] and not tokens[0].startswith("git+") and not tokens[0].endswith('.tar.gz'):
tokens[0] = 'git+' + tokens[0] tokens[0] = 'git+' + tokens[0]
if '+' in tokens[0]: if '+' in tokens[0]:
@ -408,7 +407,7 @@ def role_spec_parse(role_spec):
def role_yaml_parse(role): 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"] role["src"] = "git+" + role["src"]
if '+' in role["src"]: if '+' in role["src"]:
(scm, src) = role["src"].split('+') (scm, src) = role["src"].split('+')

View file

@ -824,7 +824,7 @@ class TestUtils(unittest.TestCase):
} }
), ),
( (
# 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", "http://github.com/ansible/fakerole/fake",
{ {
'scm' : 'git', 'scm' : 'git',
@ -832,6 +832,16 @@ class TestUtils(unittest.TestCase):
'version' : '', 'version' : '',
'name' : 'fake' '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: for (spec, result) in tests: