diff --git a/aries_cloudagent/revocation/models/issuer_revocation_record.py b/aries_cloudagent/revocation/models/issuer_revocation_record.py index e5a9ac5101..4b105570ba 100644 --- a/aries_cloudagent/revocation/models/issuer_revocation_record.py +++ b/aries_cloudagent/revocation/models/issuer_revocation_record.py @@ -1,6 +1,7 @@ """Issuer revocation registry storage handling.""" import json +import logging import uuid from typing import Sequence @@ -19,6 +20,8 @@ DEFAULT_REGISTRY_SIZE = 100 +LOGGER = logging.getLogger(__name__) + class IssuerRevocationRecord(BaseRecord): """Class for managing local issuing revocation registries.""" @@ -125,7 +128,7 @@ async def generate_registry(self, context: InjectionContext, base_dir: str): "default", tails_writer_config ) - print("create revocation registry with size:", self.max_cred_num) + LOGGER.debug("create revocation registry with size:", self.max_cred_num) ( revoc_reg_id, diff --git a/aries_cloudagent/revocation/models/revocation_registry.py b/aries_cloudagent/revocation/models/revocation_registry.py index f1232cbe38..8a82564721 100644 --- a/aries_cloudagent/revocation/models/revocation_registry.py +++ b/aries_cloudagent/revocation/models/revocation_registry.py @@ -131,7 +131,7 @@ async def create_tails_reader(self, context: InjectionContext) -> int: tails_file_path = Path(self.get_receiving_tails_local_path(context)) if not tails_file_path.exists(): - raise FileNotFoundError("Tail file does not exist.") + raise FileNotFoundError("Tails file does not exist.") tails_reader_config = json.dumps( { @@ -142,7 +142,7 @@ async def create_tails_reader(self, context: InjectionContext) -> int: return await indy.blob_storage.open_reader("default", tails_reader_config) def get_receiving_tails_local_path(self, context: InjectionContext): - """Make the local path to the tail file we download from remote URI.""" + """Make the local path to the tails file we download from remote URI.""" if self._tails_local_path: return self._tails_local_path @@ -159,7 +159,7 @@ def has_local_tails_file(self, context: InjectionContext) -> bool: async def retrieve_tails(self, context: InjectionContext): """Fetch the tails file from the public URI.""" if not self._tails_public_uri: - raise RevocationError("Tail file public uri is empty") + raise RevocationError("Tails file public URI is empty") try: tails_stream = await fetch_stream(self._tails_public_uri) diff --git a/aries_cloudagent/revocation/routes.py b/aries_cloudagent/revocation/routes.py index 8a0d6d23db..692d48f494 100644 --- a/aries_cloudagent/revocation/routes.py +++ b/aries_cloudagent/revocation/routes.py @@ -5,6 +5,8 @@ from aiohttp import web from aiohttp_apispec import docs, request_schema, response_schema +import logging + from marshmallow import fields, Schema from ..messaging.credential_definitions.util import CRED_DEF_SENT_RECORD_TYPE @@ -16,6 +18,8 @@ from .models.issuer_revocation_record import IssuerRevocationRecordSchema from .models.revocation_registry import RevocationRegistry +LOGGER = logging.getLogger(__name__) + class RevRegCreateRequestSchema(Schema): """Request schema for revocation registry creation request.""" @@ -34,10 +38,10 @@ class RevRegCreateResultSchema(Schema): class RevRegUpdateTailFileUriSchema(Schema): - """Request schema for updating tail file URI.""" + """Request schema for updating tails file URI.""" tails_public_uri = fields.Url( - description="Public URI to the tail file", required=True + description="Public URI to the tails file", required=True ) @@ -118,20 +122,20 @@ async def get_current_registry(request: web.BaseRequest): @docs( tags=["revocation"], - summary="Get the tail file of revocation registry", + summary="Download the tails file of revocation registry", produces="application/octet-stream", parameters=[{"in": "path", "name": "id", "description": "revocation registry id."}], - responses={200: {"description": "tail file", "schema": {"type": "file"}}}, + responses={200: {"description": "tails file", "schema": {"type": "file"}}}, ) async def get_tails_file(request: web.BaseRequest) -> web.FileResponse: """ - Request handler for getting the tail file of the revocation registry. + Request handler for downloading the tails file of the revocation registry. Args: request: aiohttp request object Returns: - The tail file in FileResponse + The tails file in FileResponse """ context = request.app["request_context"] @@ -174,21 +178,23 @@ async def publish_registry(request: web.BaseRequest): raise web.HTTPNotFound() from e await revoc_registry.publish_registry_definition(context) - print("published registry definition") + LOGGER.debug("published registry definition: %s", registry_id) await revoc_registry.publish_registry_entry(context) - print("published registry entry") + LOGGER.debug("published registry entry: %s", registry_id) return web.json_response({"result": revoc_registry.serialize()}) @docs( tags=["revocation"], - summary="Update revocation registry with new public URI to the tail file.", + summary="Update revocation registry with new public URI to the tails file.", parameters=[ { "in": "path", "name": "id", - "description": "use credential definition id as the revocation registry id." + "description": ( + "use credential definition id as the revocation registry id." + ), } ], ) @@ -219,7 +225,7 @@ async def update_registry(request: web.BaseRequest): raise web.HTTPNotFound() from e revoc_registry.set_tails_file_public_uri(tails_public_uri) - await revoc_registry.save(context, reason="Updating tail file public URI.") + await revoc_registry.save(context, reason="Updating tails file public URI") return web.json_response({"result": revoc_registry.serialize()})