Save downloaded gsutil tarball to workspace

`gsutil` tarball was being downloaded to the current working directory
and wasn't removed after its extraction.

This will be useful until #87 is merged.
This commit is contained in:
Tiago Ilieve 2014-06-07 13:31:10 -03:00
parent 80d0dfb939
commit 65bdb34d77

View file

@ -3,7 +3,6 @@ from bootstrapvz.common import phases
from bootstrapvz.common.tasks import apt
from bootstrapvz.common.tools import log_check_call
import os
import os.path
class DefaultPackages(Task):
@ -48,9 +47,12 @@ class InstallGSUtil(Task):
@classmethod
def run(cls, info):
log_check_call(['wget', 'http://storage.googleapis.com/pub/gsutil.tar.gz'])
gsutil_tarball = os.path.join(info.manifest.bootstrapper['workspace'], 'gsutil.tar.gz')
log_check_call(['wget', '--output-document', gsutil_tarball,
'http://storage.googleapis.com/pub/gsutil.tar.gz'])
gsutil_directory = os.path.join(info.root, 'usr/local/share/google')
gsutil_binary = os.path.join(os.path.join(info.root, 'usr/local/bin'), 'gsutil')
os.makedirs(gsutil_directory)
log_check_call(['tar', 'xaf', 'gsutil.tar.gz', '-C', gsutil_directory])
log_check_call(['tar', 'xaf', gsutil_tarball, '-C', gsutil_directory])
os.remove(gsutil_tarball)
log_check_call(['ln', '-s', '../share/google/gsutil/gsutil', gsutil_binary])