Skip to content

Commit

Permalink
Merge pull request #271 from GSA/s3-delete-objects
Browse files Browse the repository at this point in the history
S3 delete objects
  • Loading branch information
robert-bryson authored Sep 18, 2023
2 parents 87a8a76 + e9ef593 commit b47fc54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name="ckanext-geodatagov",
version="0.2.5",
version="0.2.6",
description="",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit b47fc54

Please sign in to comment.