Added logging output to azure storage to better diagnose connection problems
This commit is contained in:
parent
94beb544fa
commit
182700218a
@ -10,8 +10,8 @@ from pyinfra.config import Config, get_config
|
||||
CONFIG = get_config()
|
||||
logger = logging.getLogger(CONFIG.logging_level_root)
|
||||
|
||||
logging.getLogger("azure").setLevel(logging.WARNING)
|
||||
logging.getLogger("urllib3").setLevel(logging.WARNING)
|
||||
logging.getLogger("azure").setLevel(logging.INFO)
|
||||
logging.getLogger("urllib3").setLevel(logging.INFO)
|
||||
|
||||
|
||||
class AzureStorageAdapter(object):
|
||||
@ -38,6 +38,8 @@ class AzureStorageAdapter(object):
|
||||
blob_client.upload_blob(data, overwrite=True)
|
||||
|
||||
def exists(self, bucket_name, object_name):
|
||||
logger.info(f"Checking if object with object_name={object_name} exists in bucket bucket_name={bucket_name}")
|
||||
|
||||
container_client = self.__provide_container_client(bucket_name)
|
||||
blob_client = container_client.get_blob_client(object_name)
|
||||
return blob_client.exists()
|
||||
@ -77,4 +79,6 @@ class AzureStorageAdapter(object):
|
||||
|
||||
|
||||
def get_azure_storage(config: Config):
|
||||
return AzureStorageAdapter(BlobServiceClient.from_connection_string(conn_str=config.storage_azureconnectionstring))
|
||||
azureconnectionstring = config.storage_azureconnectionstring
|
||||
logger.info(f"Connecting to azure storage via {azureconnectionstring}")
|
||||
return AzureStorageAdapter(BlobServiceClient.from_connection_string(conn_str=azureconnectionstring))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user