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

Merge pull request #13203 from willthames/galaxy_10620

Allow tree-ish versions for ansible-galaxy
This commit is contained in:
James Cammarata 2016-02-17 08:41:29 -05:00
commit 58a6cf822a
4 changed files with 13 additions and 4 deletions

View file

@ -310,5 +310,3 @@ class GalaxyRole(object):
} }
""" """
return dict(scm=self.scm, src=self.src, version=self.version, name=self.name) return dict(scm=self.scm, src=self.src, version=self.version, name=self.name)

View file

@ -190,6 +190,17 @@ class RoleRequirement(RoleDefinition):
if rc != 0: if rc != 0:
raise AnsibleError ("- command %s failed in directory %s (rc=%s)" % (' '.join(clone_cmd), tempdir, rc)) raise AnsibleError ("- command %s failed in directory %s (rc=%s)" % (' '.join(clone_cmd), tempdir, rc))
if scm == 'git' and version:
checkout_cmd = [scm, 'checkout', version]
with open('/dev/null', 'w') as devnull:
try:
popen = subprocess.Popen(checkout_cmd, cwd=os.path.join(tempdir, name), stdout=devnull, stderr=devnull)
except (IOError, OSError):
raise AnsibleError("error executing: %s" % " ".join(checkout_cmd))
rc = popen.wait()
if rc != 0:
raise AnsibleError("- command %s failed in directory %s (rc=%s)" % (' '.join(checkout_cmd), tempdir, rc))
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.tar') temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.tar')
if scm == 'hg': if scm == 'hg':
archive_cmd = ['hg', 'archive', '--prefix', "%s/" % name] archive_cmd = ['hg', 'archive', '--prefix', "%s/" % name]

View file

@ -3,7 +3,7 @@
name: oracle_java7 name: oracle_java7
- src: git+http://bitbucket.org/willthames/git-ansible-galaxy - src: git+http://bitbucket.org/willthames/git-ansible-galaxy
version: v1.6 version: pr-10620
- src: http://bitbucket.org/willthames/hg-ansible-galaxy - src: http://bitbucket.org/willthames/hg-ansible-galaxy
scm: hg scm: hg

View file

@ -1,7 +1,7 @@
# deliberate non-empty whitespace line to follow # deliberate non-empty whitespace line to follow
git+https://bitbucket.org/willthames/git-ansible-galaxy,v1.6 git+https://bitbucket.org/willthames/git-ansible-galaxy,pr-10620
hg+https://bitbucket.org/willthames/hg-ansible-galaxy hg+https://bitbucket.org/willthames/hg-ansible-galaxy
https://bitbucket.org/willthames/http-ansible-galaxy/get/master.tar.gz,,http-role https://bitbucket.org/willthames/http-ansible-galaxy/get/master.tar.gz,,http-role
# comment # comment