diff options
author | Will Thames <will@thames.id.au> | 2014-09-10 09:07:50 +1000 |
---|---|---|
committer | Will Thames <will@thames.id.au> | 2014-09-10 09:16:30 +1000 |
commit | 537472f42cbd2a380fa090f1d09a21ed3e5b44e5 (patch) | |
tree | 536bbe3c9d8afd36d969c1cae526581008f37f40 | |
parent | a9b5b1bf55728b5d9dd38dc614be491a2c4217f0 (diff) | |
download | ansible-537472f42cbd2a380fa090f1d09a21ed3e5b44e5.tar.gz |
Make ansible-galaxy work as expected
This change fixes hg galaxy roles
Roles also get installed if roles path is missing, which
the tests currently require (fixes #8950)
-rwxr-xr-x | bin/ansible-galaxy | 8 | ||||
-rw-r--r-- | lib/ansible/utils/__init__.py | 7 |
2 files changed, 3 insertions, 12 deletions
diff --git a/bin/ansible-galaxy b/bin/ansible-galaxy index 146361da93..7598580d82 100755 --- a/bin/ansible-galaxy +++ b/bin/ansible-galaxy @@ -704,14 +704,6 @@ def execute_install(args, options, parser): print "- please specify a user/role name, or a roles file, but not both" sys.exit(1) - # error checking to ensure the specified roles path exists and is a directory - if not os.path.exists(roles_path): - print "- the specified role path %s does not exist" % roles_path - sys.exit(1) - elif not os.path.isdir(roles_path): - print "- the specified role path %s is not a directory" % roles_path - sys.exit(1) - roles_done = [] if role_file: f = open(role_file, 'r') diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index 98b7f2f36b..fa11291776 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -387,15 +387,12 @@ def role_spec_parse(role_spec): role_spec = role_spec.strip() role_version = '' + default_role_versions = dict(git='master', hg='tip') 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' if 'github.com/' in tokens[0] and not tokens[0].startswith("git+") and not tokens[0].endswith('.tar.gz'): @@ -412,6 +409,8 @@ def role_spec_parse(role_spec): role_name = tokens[2] else: role_name = repo_url_to_role_name(tokens[0]) + if scm and not role_version: + role_version = default_role_versions.get(scm, '') return dict(scm=scm, src=role_url, version=role_version, name=role_name) |