diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 780729c27..051fdbd13 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -183,9 +183,7 @@ jobs: inputs: secureFile: 'ci-gcs-dev.json' - script: | - pip install azure-storage-blob==12.0.0b3 - # the recent release 1.0.0b4 has a breaking change - pip install azure-core==1.0.0b3 + pip install azure-storage-blob==12.12.0 # acquire the mutex before running live tests to avoid conflicts python ./tool_distributed_mutex.py lock "$(MUTEX_URL)" # set the variable to indicate that the mutex was actually acquired @@ -241,9 +239,7 @@ jobs: S2S_SRC_GCP_SERVICE_URL: $(S2S_SRC_GCP_SERVICE_URL) SHARE_SAS_URL: $(SHARE_SAS_URL) - script: | - pip install azure-storage-blob==12.0.0b3 - # the recent release 1.0.0b4 has a breaking change - pip install azure-core==1.0.0b3 + pip install azure-storage-blob==12.12.0 python ./tool_distributed_mutex.py unlock "$(MUTEX_URL)" name: 'Release_the_distributed_mutex' # this runs even if the job was canceled (only if the mutex was acquired by this job) diff --git a/tool_distributed_mutex.py b/tool_distributed_mutex.py index 564a7a320..e02fe75c1 100644 --- a/tool_distributed_mutex.py +++ b/tool_distributed_mutex.py @@ -5,10 +5,10 @@ # note that the track 2 python SDK is being used here from azure.storage.blob import ( BlobClient, - LeaseClient, + BlobLeaseClient, ) -from azure.core import ( +from azure.core.exceptions import ( HttpResponseError, ) @@ -31,7 +31,7 @@ def process(): action, mutex_url = get_raw_input() # check whether the blob exists, if not quit right away to avoid wasting time - blob_client = BlobClient(mutex_url) + blob_client = BlobClient.from_blob_url(mutex_url) try: blob_client.get_blob_properties() print("INFO: validated mutex url") @@ -39,7 +39,7 @@ def process(): raise ValueError('please provide an existing and valid blob URL, failed to get properties with error: ' + e) # get a handle on the lease - lease_client = LeaseClient(blob_client) + lease_client = BlobLeaseClient(blob_client) if action == UNLOCK: # make the lease free as soon as possible lease_client.break_lease(lease_break_period=1)