Properly connect the github push webhook with the build worker. Still need to resolve the archive format.

This commit is contained in:
jakedt 2014-02-18 18:09:14 -05:00
parent ed38bcdafc
commit f60f9eb62a
8 changed files with 57 additions and 34 deletions

View file

@ -40,14 +40,15 @@ class UserRequestFiles(object):
encrypt_key=True)
return (url, file_id)
def store_file(self, flask_file):
def store_file(self, file_like_obj, content_type):
self._initialize_s3()
file_id = str(uuid4())
full_key = os.path.join(self._prefix, file_id)
k = Key(self._bucket, full_key)
logger.debug('Setting s3 content type to: %s' % flask_file.content_type)
k.set_metadata('Content-Type', flask_file.content_type)
bytes_written = k.set_contents_from_file(flask_file, encrypt_key=True)
logger.debug('Setting s3 content type to: %s' % content_type)
k.set_metadata('Content-Type', content_type)
bytes_written = k.set_contents_from_file(file_like_obj, encrypt_key=True,
rewind=True)
if bytes_written == 0:
raise S3FileWriteException('Unable to write file to S3')