mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Handle older git archive commands
Older git archive commands create tar archives even with a tar.gz extension. So change it to always create tar archives and have the install_role method cope. Removed ssh roles from the test case as they don't work unless you can connect to bitbucket via ssh and have your key there. Corrected a minor typo in error messages
This commit is contained in:
parent
ada9074276
commit
31540246dd
3 changed files with 8 additions and 5 deletions
|
@ -343,10 +343,10 @@ def scm_archive_role(scm, role_url, role_version, role_name):
|
|||
rc = popen.wait()
|
||||
if rc != 0:
|
||||
print "Command %s failed" % ' '.join(clone_cmd)
|
||||
print "in directory %s" % temp_dir
|
||||
print "in directory %s" % tempdir
|
||||
return False
|
||||
|
||||
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.tar.gz')
|
||||
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.tar')
|
||||
if scm == 'hg':
|
||||
archive_cmd = ['hg', 'archive', '--prefix', "%s/" % role_name]
|
||||
if role_version:
|
||||
|
@ -491,7 +491,10 @@ def install_role(role_name, role_version, role_filename, options):
|
|||
print "Error: the file downloaded was not a tar.gz"
|
||||
return False
|
||||
else:
|
||||
role_tar_file = tarfile.open(role_filename, "r:gz")
|
||||
if role_filename.endswith('.gz'):
|
||||
role_tar_file = tarfile.open(role_filename, "r:gz")
|
||||
else:
|
||||
role_tar_file = tarfile.open(role_filename, "r")
|
||||
# verify the role's meta file
|
||||
meta_file = None
|
||||
members = role_tar_file.getmembers()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
- src: git+http://bitbucket.org/willthames/git-ansible-galaxy
|
||||
version: v1.4
|
||||
|
||||
- src: ssh://hg@bitbucket.org/willthames/hg-ansible-galaxy
|
||||
- src: http://bitbucket.org/willthames/hg-ansible-galaxy
|
||||
scm: hg
|
||||
|
||||
- src: https://bitbucket.org/willthames/http-ansible-galaxy/get/master.tar.gz
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
git+http://bitbucket.org/willthames/git-ansible-galaxy,v1.4
|
||||
hg+ssh://hg@bitbucket.org/willthames/hg-ansible-galaxy
|
||||
hg+http://bitbucket.org/willthames/hg-ansible-galaxy
|
||||
https://bitbucket.org/willthames/http-ansible-galaxy/get/master.tar.gz,,http-role
|
||||
|
|
Loading…
Reference in a new issue