summaryrefslogtreecommitdiff
path: root/lib/ansible/playbook/role/requirement.py
diff options
context:
space:
mode:
authorBrian Coca <brian.coca+git@gmail.com>2015-10-20 14:38:07 -0400
committerBrian Coca <brian.coca+git@gmail.com>2015-10-20 14:39:22 -0400
commit1ecad5aed2ba51705ec04abf717e80d44490b5dd (patch)
tree7337741993faab6fa7dd234230670919528e051f /lib/ansible/playbook/role/requirement.py
parentb46ce47a84085da66272c6194d00f9e527a7d2a9 (diff)
downloadansible-1ecad5aed2ba51705ec04abf717e80d44490b5dd.tar.gz
now galaxy correctly detects empty requirements file
also allow for 'scm' and 'src' not to be populated in requirements entries
Diffstat (limited to 'lib/ansible/playbook/role/requirement.py')
-rw-r--r--lib/ansible/playbook/role/requirement.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/ansible/playbook/role/requirement.py b/lib/ansible/playbook/role/requirement.py
index 5de1876c31..86942a9b29 100644
--- a/lib/ansible/playbook/role/requirement.py
+++ b/lib/ansible/playbook/role/requirement.py
@@ -140,17 +140,19 @@ class RoleRequirement(RoleDefinition):
role = RoleRequirement.role_spec_parse(role['role'])
else:
role = role.copy()
- # New style: { src: 'galaxy.role,version,name', other_vars: "here" }
- 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('+')
- role["scm"] = scm
- role["src"] = src
+ if 'src'in role:
+ # New style: { src: 'galaxy.role,version,name', other_vars: "here" }
+ 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 'name' not in role:
- role["name"] = RoleRequirement.repo_url_to_role_name(role["src"])
+ if '+' in role["src"]:
+ (scm, src) = role["src"].split('+')
+ role["scm"] = scm
+ role["src"] = src
+
+ if 'name' not in role:
+ role["name"] = RoleRequirement.repo_url_to_role_name(role["src"])
if 'version' not in role:
role['version'] = ''