diff options
Diffstat (limited to '.travis/after_script')
-rwxr-xr-x | .travis/after_script | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/.travis/after_script b/.travis/after_script index 469796be9..37fd37eb8 100755 --- a/.travis/after_script +++ b/.travis/after_script @@ -1,20 +1,20 @@ #!/usr/bin/env python import hashlib -import json import os import subprocess import sys import tarfile -sharename = '48rLGpU1' +import boto +from boto.s3.key import Key root = os.path.join(os.path.dirname(__file__), '..') with open(os.path.join(root, 'cpanfile.snapshot')) as cpanfile: hash = hashlib.md5(cpanfile.read()).hexdigest() wanted_filename = 'fixmystreet-local-%s.tgz' % hash -if os.path.exists(wanted_filename): +if os.path.exists(wanted_filename) and os.path.getsize(wanted_filename): print "File was downloaded, no need to upload" sys.exit() @@ -23,27 +23,11 @@ tfile = tarfile.open(wanted_filename, 'w:gz') tfile.add('local') tfile.close() -print "Logging in..." -refreshtoken = os.getenv('TOKEN') -if not refreshtoken: - print " No token available, bailing" - sys.exit() -output = subprocess.check_output([ - 'curl', '-s', '-X', 'POST', '--data', '{"refreshtoken":"%s"}' % refreshtoken, - 'https://open.ge.tt/1/users/login' -]) -output = json.loads(output) -accesstoken = output['accesstoken'] - -print "Creating file..." -output = subprocess.check_output([ - 'curl', '-s', '-X', 'POST', '--data', '{"filename":"%s"}' % wanted_filename, - 'https://open.ge.tt/1/files/%s/create?accesstoken=%s' % (sharename, accesstoken) -]) -output = json.loads(output) -puturl = output['upload']['puturl'] +print "Uploading archive to S3..." +conn = boto.connect_s3() +bucket = conn.get_bucket('fixmystreet-bundle-cache') +key = Key(bucket) +key.key = wanted_filename +key.set_contents_from_filename(wanted_filename) -print "Uploading archive to ge.tt..." -with open('output', 'w') as out: - subprocess.call([ 'curl', '-#', '--upload-file', wanted_filename, puturl ], stdout=out) print "Completed" |