@@ -64,7 +64,7 @@ def with_storage(self, iterable):
6464
6565
6666def upload_blobs (
67- storage , src , dest , bucket , max_workers = None , multi_part_upload_threshold = 0
67+ storage , src , dest , bucket , canned_acl , max_workers = None , multi_part_upload_threshold = 0
6868):
6969 """
7070 Uploads a list of files from local storage concurrently to the remote storage.
@@ -80,14 +80,14 @@ def upload_blobs(
8080 job = StorageJob (
8181 storage ,
8282 lambda storage , connection , src_file : __upload_file (
83- storage , connection , src_file , dest , bucket , multi_part_upload_threshold
83+ storage , connection , src_file , dest , bucket , canned_acl , multi_part_upload_threshold
8484 ),
8585 max_workers ,
8686 )
8787 return job .execute (list (src ))
8888
8989
90- def __upload_file (storage , connection , src , dest , bucket , multi_part_upload_threshold ):
90+ def __upload_file (storage , connection , src , dest , bucket , canned_acl , multi_part_upload_threshold ):
9191 """
9292 This function is called by StorageJob. It may be called concurrently by multiple threads.
9393
@@ -116,15 +116,16 @@ def __upload_file(storage, connection, src, dest, bucket, multi_part_upload_thre
116116 obj = _upload_multi_part (storage , connection , src , bucket , full_object_name )
117117 else :
118118 logging .debug ("Uploading {} as single part" .format (full_object_name ))
119- obj = _upload_single_part (connection , src , bucket , full_object_name )
119+ obj = _upload_single_part (connection , src , bucket , full_object_name , canned_acl )
120120
121121 return medusa .storage .ManifestObject (obj .name , int (obj .size ), obj .hash )
122122
123123
124124@retry (stop_max_attempt_number = MAX_UP_DOWN_LOAD_RETRIES , wait_fixed = 5000 )
125- def _upload_single_part (connection , src , bucket , object_name ):
125+ def _upload_single_part (connection , src , bucket , object_name , canned_acl ):
126+ extra = {'content_type' : 'application/octet-stream' , 'acl' : canned_acl }
126127 obj = connection .upload_object (
127- str (src ), container = bucket , object_name = object_name
128+ str (src ), container = bucket , object_name = object_name , extra = extra
128129 )
129130
130131 return obj
0 commit comments