diff --git a/lisa/sut_orchestrator/azure/common.py b/lisa/sut_orchestrator/azure/common.py index 684f716591..b4152d8a86 100644 --- a/lisa/sut_orchestrator/azure/common.py +++ b/lisa/sut_orchestrator/azure/common.py @@ -69,16 +69,14 @@ ResourceManagementClient, SubscriptionClient, ) -from azure.mgmt.storage import StorageManagementClient # type: ignore -from azure.mgmt.storage.models import ( # type: ignore - Sku, - StorageAccountCreateParameters, -) +from azure.mgmt.storage import StorageManagementClient +from azure.mgmt.storage.models import Sku, StorageAccountCreateParameters from azure.storage.blob import ( BlobClient, BlobSasPermissions, BlobServiceClient, ContainerClient, + ContentSettings, generate_blob_sas, ) from azure.storage.fileshare import ShareServiceClient @@ -1632,7 +1630,7 @@ def generate_user_delegation_sas_token( container_name=container_name, blob_name=blob_name, user_delegation_key=user_delegation_key, - permission=BlobSasPermissions(read=True, write=writable), # type: ignore + permission=BlobSasPermissions(read=True, write=writable), expiry=expiry_time, start=start_time, ) @@ -1803,12 +1801,11 @@ def copy_vhd_to_storage( ) -> str: # get original vhd's hash key for comparing. original_key: Optional[bytearray] = None - original_blob_client = BlobClient.from_blob_url(src_vhd_sas_url) + original_blob_client: BlobClient = BlobClient.from_blob_url(src_vhd_sas_url) properties = original_blob_client.get_blob_properties() - if properties.content_settings: - original_key = properties.content_settings.get( - "content_md5", None - ) # type: ignore + content_settings: Optional[ContentSettings] = properties.content_settings + if content_settings: + original_key = content_settings.get("content_md5", None) # type: ignore container_client = get_or_create_storage_container( credential=platform.credential, diff --git a/microsoft/testsuites/vm_extensions/runtime_extensions/common.py b/microsoft/testsuites/vm_extensions/runtime_extensions/common.py index 72251c8bdc..180b6e6d29 100644 --- a/microsoft/testsuites/vm_extensions/runtime_extensions/common.py +++ b/microsoft/testsuites/vm_extensions/runtime_extensions/common.py @@ -83,7 +83,7 @@ def retrieve_storage_blob_url( test_file: str = "", is_sas: bool = False, script: str = "", - blob_type: BlobType = BlobType.BlockBlob, + blob_type: BlobType = BlobType.BLOCKBLOB, ) -> Any: platform = environment.platform assert isinstance(platform, AzurePlatform) @@ -123,7 +123,7 @@ def retrieve_storage_blob_url( raise ex # Upload blob to container if doesn't exist container_client.upload_blob( - name=blob_name, data=blob_data, blob_type=blob_type # type: ignore + name=blob_name, data=blob_data, blob_type=blob_type ) blob_url = blob.url diff --git a/pyproject.toml b/pyproject.toml index 7ccbfedca8..696a0e8fdb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools >= 65", "setuptools_scm[toml] >= 6.2"] +requires = ["setuptools >= 70", "setuptools_scm[toml] >= 6.2"] build-backend = "setuptools.build_meta" @@ -49,9 +49,9 @@ azure = [ "azure-mgmt-privatedns ~= 1.0.0", "azure-mgmt-resource ~= 21.0.0", "azure-mgmt-serialconsole ~= 1.0.0", - "azure-mgmt-storage ~= 20.0.0", - "azure-storage-blob ~= 12.11.0", - "azure-storage-file-share ~= 12.16.0", + "azure-mgmt-storage ~= 21.2.1", + "azure-storage-blob ~= 12.23.0", + "azure-storage-file-share ~= 12.18.0", "azure-keyvault-secrets ~= 4.7.0", "azure-keyvault-certificates ~= 4.7.0", "msrestazure ~= 0.6.4",