diff --git a/pavelib/utils/db_utils.py b/pavelib/utils/db_utils.py index bed0f0f074..7861b77f42 100644 --- a/pavelib/utils/db_utils.py +++ b/pavelib/utils/db_utils.py @@ -211,7 +211,7 @@ def create_tarfile_from_db_cache(fingerprint, files, path): return zipfile_name, zipfile_path -def upload_to_s3(file_name, file_path, bucket_name): +def upload_to_s3(file_name, file_path, bucket_name, replace=False): """ Upload the specified files to an s3 bucket. """ @@ -229,7 +229,7 @@ def upload_to_s3(file_name, file_path, bucket_name): "Continuing without uploading the new cache to S3.") return key = boto.s3.key.Key(bucket=bucket, name=file_name) - bytes_written = key.set_contents_from_filename(file_path, replace=False, policy='public-read') + bytes_written = key.set_contents_from_filename(file_path, replace=replace, policy='public-read') if bytes_written: msg = u"Wrote {} bytes to {}.".format(bytes_written, key.name) else: diff --git a/pavelib/utils/test/utils.py b/pavelib/utils/test/utils.py index 8b562660b6..5cb543670d 100644 --- a/pavelib/utils/test/utils.py +++ b/pavelib/utils/test/utils.py @@ -179,5 +179,6 @@ def upload_coverage_to_s3(): upload_to_s3( COVERAGE_CACHE_BASELINE, 'reports/{}.coverage'.format(os.environ.get('TEST_SUITE', '')), - COVERAGE_CACHE_BUCKET + COVERAGE_CACHE_BUCKET, + replace=True, )