Commit 5dd899d0 authored by Christophe Lallement's avatar Christophe Lallement
Browse files

logging get_credentials in azure blob client

parent a95216c4
import logging
from typing import Optional, List, Any
from import BlobServiceClient
......@@ -18,6 +19,8 @@ from import (
from osdu_az.partition.partition_service import PartitionService
_LOGGER = logging.getLogger(__name__)
class AzureAioBlobStorage(BlobStorageBase):
......@@ -46,10 +49,13 @@ class AzureAioBlobStorage(BlobStorageBase):
def _get_credentials(self):
if AzureAioBlobStorage.Credentials is None:"Acquire new Credentials using DefaultAzureCredential")
AzureAioBlobStorage.Credentials = DefaultAzureCredential(
else:"Using cached Credentials")
return AzureAioBlobStorage.Credentials
async def _get_blob_service_client(self, tenant):
......@@ -61,6 +67,7 @@ class AzureAioBlobStorage(BlobStorageBase):
async def close_credentials(cls):
""" This cause to gracefully dispose credentials if any. Next calls will then initialize a new one """"Closing cached Credentials")
credentials_to_close, cls.Credentials = cls.Credentials, None # swap
if credentials_to_close is not None:
await credentials_to_close.close()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment