diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index 5c431dadae..c3d3708352 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -381,11 +381,15 @@ def role_spec_parse(role_spec): # } role_spec = role_spec.strip() - role_version = 'master' + role_version = '' if role_spec == "" or role_spec.startswith("#"): return (None, None, None, None) tokens = [s.strip() for s in role_spec.split(',')] + + if not tokens[0].endswith('.tar.gz'): + # pick a reasonable default branch + role_version = 'master' # assume https://github.com URLs are git+https:// URLs and not # tarballs unless they end in '.zip' diff --git a/test/units/TestUtils.py b/test/units/TestUtils.py index 1c82e353ef..08fb037009 100644 --- a/test/units/TestUtils.py +++ b/test/units/TestUtils.py @@ -829,7 +829,7 @@ class TestUtils(unittest.TestCase): { 'scm' : 'git', 'src' : 'http://github.com/ansible/fakerole/fake', - 'version' : '', + 'version' : 'master', 'name' : 'fake' } ),