Skip to content

Commit

Permalink
correct s3 delete-objects
Browse files Browse the repository at this point in the history
  • Loading branch information
FuhuXia committed Sep 18, 2023
1 parent 87a8a76 commit 39339ec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ckanext/geodatagov/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ def upload_to_key(upload_str: str, filename_on_s3: str) -> None:


def delete_old_sitemaps():
objects_to_delete = S3.meta.client.list_objects(Bucket=BUCKET_NAME, Prefix=PREFIX)
objects_to_delete = S3.list_objects(Bucket=BUCKET_NAME, Prefix=PREFIX)

delete_keys = {'Objects': []}
delete_keys['Objects'] = [{'Key': k} for k in [obj['Key'] for obj in objects_to_delete.get('Contents', [])]]

S3.meta.client.delete_objects(Bucket=BUCKET_NAME, Delete=delete_keys)
S3.delete_objects(Bucket=BUCKET_NAME, Delete=delete_keys)


def upload_sitemap_file(sitemap: list) -> None:
Expand Down

0 comments on commit 39339ec

Please sign in to comment.