Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Domain Data Mgmt Services
Wellbore
Lib
Wellbore-cloud
Wellbore-azure-lib
Commits
5dd899d0
Commit
5dd899d0
authored
Jun 04, 2021
by
Christophe Lallement
Browse files
logging get_credentials in azure blob client
parent
a95216c4
Changes
1
Show whitespace changes
Inline
Side-by-side
osdu_az/storage/blob_storage_az.py
View file @
5dd899d0
import
logging
from
typing
import
Optional
,
List
,
Any
from
azure.storage.blob.aio
import
BlobServiceClient
...
...
@@ -18,6 +19,8 @@ from osdu.core.api.storage.exceptions 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
:
_LOGGER
.
info
(
f
"Acquire new Credentials using DefaultAzureCredential"
)
AzureAioBlobStorage
.
Credentials
=
DefaultAzureCredential
(
exclude_shared_token_cache_credential
=
True
,
exclude_visual_studio_code_credential
=
True
,
exclude_environment_credential
=
True
)
else
:
_LOGGER
.
info
(
f
"Using cached Credentials"
)
return
AzureAioBlobStorage
.
Credentials
async
def
_get_blob_service_client
(
self
,
tenant
):
...
...
@@ -61,6 +67,7 @@ class AzureAioBlobStorage(BlobStorageBase):
@
classmethod
async
def
close_credentials
(
cls
):
""" This cause to gracefully dispose credentials if any. Next calls will then initialize a new one """
_LOGGER
.
info
(
f
"Closing cached Credentials"
)
credentials_to_close
,
cls
.
Credentials
=
cls
.
Credentials
,
None
# swap
if
credentials_to_close
is
not
None
:
await
credentials_to_close
.
close
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment