diff --git a/src_py/main.py b/src_py/main.py index adaf8b9..2bb2b86 100644 --- a/src_py/main.py +++ b/src_py/main.py @@ -3,7 +3,6 @@ import boto3 import concurrent.futures - ed_pub_account_id = os.getenv('EDPUB_ACCOUNT_ID') source_bucket = os.getenv('EDPUB_BUCKET') destination_bucket = os.getenv('DAAC_BUCKET') @@ -50,24 +49,22 @@ def scan_ed_pub(s3_client): def handle_s3_event_message(event, s3_client): object_key = event.get('Records')[0].get('s3').get('object').get('key') - return s3_client.copy_object( + s3_client.copy_object( Bucket=destination_bucket, CopySource={ 'Bucket': source_bucket, 'Key': object_key }, - Key=object_key + Key=f'pub/{object_key.split("/", 2)[-1]}' ) def handler(event, context): s3_client = boto3.client('s3') if event.get('Records', None): - ret = handle_s3_event_message(event, s3_client) + handle_s3_event_message(event, s3_client) else: - ret = scan_ed_pub(s3_client) - - return ret + scan_ed_pub(s3_client) if __name__ == '__main__':