diff --git a/esgf-consumer/esgf_consumer/__init__.py b/esgf-consumer/esgf_consumer/__init__.py index 13cac99..2dca54e 100644 --- a/esgf-consumer/esgf_consumer/__init__.py +++ b/esgf-consumer/esgf_consumer/__init__.py @@ -176,14 +176,15 @@ async def _handle_message( ) logger.critical("Item %s deleted.", event.data.payload.item_id) - case RevokePayload(method="PATCH"): - await soft_delete_item( - event.data.payload.collection_id, - event.data.payload.item_id, - settings, - client, - ) - logger.critical("Item %s deleted.", event.data.payload.item_id) + # Not Yet Implemented + # case RevokePayload(method="PATCH"): + # await soft_delete_item( + # event.data.payload.collection_id, + # event.data.payload.item_id, + # settings, + # client, + # ) + # logger.critical("Item %s deleted.", event.data.payload.item_id) case _: raise ESGFConsumerUnknownPayloadError diff --git a/esgf-consumer/esgf_consumer/items.py b/esgf-consumer/esgf_consumer/items.py index 1cec23e..93a46ad 100644 --- a/esgf-consumer/esgf_consumer/items.py +++ b/esgf-consumer/esgf_consumer/items.py @@ -45,28 +45,29 @@ async def update_item( return None -async def soft_delete_item( - collection_id: str, - item: Item, - item_id: str, - settings: Settings, - client: httpx.AsyncClient, -) -> None: +# Not Yet Implemented +# async def soft_delete_item( +# collection_id: str, +# item: Item, +# item_id: str, +# settings: Settings, +# client: httpx.AsyncClient, +# ) -> None: - path = f"collections/{collection_id}/items/{item_id}" - url = urljoin(str(settings.stac_server), path) +# path = f"collections/{collection_id}/items/{item_id}" +# url = urljoin(str(settings.stac_server), path) - patch_data = {"retracted": True} +# patch_data = {"retracted": True} - logger.critical("Revoking %s at %s", getattr(item.properties, "instance_id"), url) - result = await client.patch(url, content=patch_data, timeout=5) - if result.status_code < 300: - logger.critical("Item Revoked") +# logger.critical("Revoking %s at %s", getattr(item.properties, "instance_id"), url) +# result = await client.patch(url, content=patch_data, timeout=5) +# if result.status_code < 300: +# logger.critical("Item Revoked") - else: - logger.critical("Item not revoked: %s", result.content) +# else: +# logger.critical("Item not revoked: %s", result.content) - return None +# return None async def hard_delete_item( diff --git a/esgf-generator/esgf_generator/cli.py b/esgf-generator/esgf_generator/cli.py index 0998b7f..cf3a9e2 100644 --- a/esgf-generator/esgf_generator/cli.py +++ b/esgf-generator/esgf_generator/cli.py @@ -166,11 +166,12 @@ def esgf_delete( result = client.delete( f"http://localhost:{NODE_PORTS[node]}/{collection_id}/items/{item_id}" ) - else: - result = client.patch( - f"http://localhost:{NODE_PORTS[node]}/{collection_id}/items/{item_id}", - content={"retracted": True}, - ) + # Not Yet Implemented + # else: + # result = client.patch( + # f"http://localhost:{NODE_PORTS[node]}/{collection_id}/items/{item_id}", + # content={"retracted": True}, + # ) if result.status_code >= 300: raise Exception(result.content) diff --git a/esgf-transaction-api/esgf_transaction_api/main.py b/esgf-transaction-api/esgf_transaction_api/main.py index e53051d..866d781 100644 --- a/esgf-transaction-api/esgf_transaction_api/main.py +++ b/esgf-transaction-api/esgf_transaction_api/main.py @@ -116,12 +116,13 @@ async def modify_item(collection_id: str, item: Item, item_id: str) -> None: await post_message(event) -async def revoke_item_soft(collection_id: str, item_id: str) -> None: - payload = RevokePayload( - method="PATCH", collection_id=collection_id, item_id=item_id - ) - event = item_body(payload) - await post_message(event) +# Not Yet Implemented +# async def revoke_item_soft(collection_id: str, item_id: str) -> None: +# payload = RevokePayload( +# method="PATCH", collection_id=collection_id, item_id=item_id +# ) +# event = item_body(payload) +# await post_message(event) async def revoke_item_hard(collection_id: str, item_id: str) -> None: @@ -194,5 +195,6 @@ async def delete_item(item_id: str, collection_id: str, request: Request) -> Non logger.info("Deleting %s item", collection_id) if request.method == "DELETE": await revoke_item_hard(collection_id, item_id) - else: - await revoke_item_soft(collection_id, item_id) + # Not yet Implemented + # else: + # await revoke_item_soft(collection_id, item_id)