@@ -19,17 +19,18 @@ class EessiTarball:
1919 for which it interfaces with the S3 bucket, GitHub, and CVMFS.
2020 """
2121
22- def __init__ (self , object_name , config , github , s3 ):
22+ def __init__ (self , object_name , config , github , s3 , bucket ):
2323 """Initialize the tarball object."""
2424 self .config = config
2525 self .github = github
2626 self .git_repo = github .get_repo (config ['github' ]['staging_repo' ])
2727 self .metadata_file = object_name + config ['paths' ]['metadata_file_extension' ]
2828 self .object = object_name
2929 self .s3 = s3
30+ self .bucket = bucket
3031 self .local_path = os .path .join (config ['paths' ]['download_dir' ], os .path .basename (object_name ))
3132 self .local_metadata_path = self .local_path + config ['paths' ]['metadata_file_extension' ]
32- self .url = f'https://{ config [ "aws" ][ "staging_bucket" ] } .s3.amazonaws.com/{ object_name } '
33+ self .url = f'https://{ bucket } .s3.amazonaws.com/{ object_name } '
3334
3435 self .states = {
3536 'new' : {'handler' : self .mark_new_tarball_as_staged , 'next_state' : 'staged' },
@@ -47,21 +48,20 @@ def download(self, force=False):
4748 """
4849 Download this tarball and its corresponding metadata file, if this hasn't been already done.
4950 """
50- bucket = self .config ['aws' ]['staging_bucket' ]
5151 if force or not os .path .exists (self .local_path ):
5252 try :
53- self .s3 .download_file (bucket , self .object , self .local_path )
53+ self .s3 .download_file (self . bucket , self .object , self .local_path )
5454 except :
5555 logging .error (
56- f'Failed to download tarball { self .object } from { bucket } to { self .local_path } .'
56+ f'Failed to download tarball { self .object } from { self . bucket } to { self .local_path } .'
5757 )
5858 self .local_path = None
5959 if force or not os .path .exists (self .local_metadata_path ):
6060 try :
61- self .s3 .download_file (bucket , self .metadata_file , self .local_metadata_path )
61+ self .s3 .download_file (self . bucket , self .metadata_file , self .local_metadata_path )
6262 except :
6363 logging .error (
64- f'Failed to download metadata file { self .metadata_file } from { bucket } to { self .local_metadata_path } .'
64+ f'Failed to download metadata file { self .metadata_file } from { self . bucket } to { self .local_metadata_path } .'
6565 )
6666 self .local_metadata_path = None
6767
0 commit comments