44from contextlib import suppress
55from typing import Literal , TypeVar
66
7+ from common_library .logging .logging_errors import create_troubleshooting_log_kwargs
78from models_library .api_schemas_catalog .services import (
89 LatestServiceGet ,
910 MyServiceGet ,
2223from models_library .services_types import ServiceKey , ServiceVersion
2324from models_library .users import UserID
2425from pydantic import HttpUrl
25- from servicelib .logging_errors import (
26- create_troubleshooting_log_kwargs ,
27- )
2826from servicelib .rabbitmq .rpc_interfaces .catalog .errors import (
2927 CatalogForbiddenError ,
3028 CatalogInconsistentError ,
@@ -108,7 +106,6 @@ def _to_latest_get_schema(
108106 access_rights_db : list [ServiceAccessRightsDB ],
109107 service_manifest : ServiceMetaDataPublished ,
110108) -> LatestServiceGet :
111-
112109 assert len (service_db .history ) == 0 # nosec
113110
114111 return LatestServiceGet .model_validate (
@@ -397,7 +394,6 @@ async def get_catalog_service(
397394 service_key : ServiceKey ,
398395 service_version : ServiceVersion ,
399396) -> ServiceGetV2 :
400-
401397 access_rights = await check_catalog_service_permissions (
402398 repo = repo ,
403399 product_name = product_name ,
@@ -449,7 +445,6 @@ async def update_catalog_service(
449445 service_version : ServiceVersion ,
450446 update : ServiceUpdateV2 ,
451447) -> ServiceGetV2 :
452-
453448 if is_function_service (service_key ):
454449 raise CatalogForbiddenError (
455450 name = f"function service { service_key } :{ service_version } " ,
@@ -482,7 +477,6 @@ async def update_catalog_service(
482477
483478 # Updates service_access_rights (they can be added/removed/modified)
484479 if update .access_rights :
485-
486480 # before
487481 previous_gids = [r .gid for r in access_rights ]
488482
@@ -602,7 +596,6 @@ async def batch_get_user_services(
602596 ]
603597 ],
604598) -> list [MyServiceGet ]:
605-
606599 services_access_rights = await repo .batch_get_services_access_rights (
607600 key_versions = ids , product_name = product_name
608601 )
@@ -612,7 +605,6 @@ async def batch_get_user_services(
612605
613606 my_services = []
614607 for service_key , service_version in ids :
615-
616608 # Evaluate user's access-rights to this service key:version
617609 access_rights = services_access_rights .get ((service_key , service_version ), [])
618610 my_access_rights = ServiceGroupAccessRightsV2 (execute = False , write = False )
@@ -695,7 +687,6 @@ async def list_user_service_release_history(
695687 # result options
696688 include_compatibility : bool = False ,
697689) -> tuple [PageTotalCount , list [ServiceRelease ]]:
698-
699690 total_count , history = await repo .get_service_history_page (
700691 # NOTE: that the service history might be different for each user
701692 # since access rights are defined on a version basis (i.e. one use can have access to v1 but ot to v2)
0 commit comments