diff options
author | Will Thames <will@thames.id.au> | 2014-08-19 08:06:46 +0200 |
---|---|---|
committer | Michael DeHaan <michael@ansible.com> | 2014-08-21 23:15:23 +0200 |
commit | 31540246dd1d05379ad03437656759479590c06d (patch) | |
tree | 3ee9b5d43069af14ac85264995618fa41a38e999 /bin/ansible-galaxy | |
parent | Allow installation of roles from yaml roles file (diff) | |
download | ansible-31540246dd1d05379ad03437656759479590c06d.tar.xz ansible-31540246dd1d05379ad03437656759479590c06d.zip |
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
Diffstat (limited to 'bin/ansible-galaxy')
-rwxr-xr-x | bin/ansible-galaxy | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/ansible-galaxy b/bin/ansible-galaxy index 3c624693b3..79594bad97 100755 --- a/bin/ansible-galaxy +++ b/bin/ansible-galaxy @@ -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() |