feat: ローカルのファイルを削除する処理が抜けていたのを修正

This commit is contained in:
高木要 2023-07-14 15:21:36 +09:00
parent 774bfbcb6b
commit 08da78a96b

View File

@ -161,6 +161,8 @@ class MasterMainteService(BaseService):
bucket_name = environment.MASTER_MAINTENANCE_BUCKET
file_key = f'data/{os.path.basename(local_file_path)}'
self.s3_client.upload_file(local_file_path, bucket_name, file_key)
# アップロード後、ローカルからは削除する
self.delete_local_file(local_file_path)
def generate_download_file_url(self, local_file_path: str) -> str:
bucket_name = environment.MASTER_MAINTENANCE_BUCKET
@ -177,3 +179,6 @@ class MasterMainteService(BaseService):
else:
raise Exception(f'登録テーブルの選択値が不正です: {select_table}')
return (table_name, selected_table_msg)
def delete_local_file(self, local_file_path: str):
os.remove(local_file_path)