File 0001-fence_azure-fix-pinning-client-api-versions-for-comp.patch of Package fence-agents.34832

From 40a71a94e80da3bfce2607aaa584d57183cbaa35 Mon Sep 17 00:00:00 2001
From: devanshjain <devanshjain@microsoft.com>
Date: Thu, 13 Jun 2024 18:00:49 +0000
Subject: [PATCH 1/1] fence_azure: fix pinning client api versions for
 compatibility across different azure sdk versions

---
 lib/azure_fence.py.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/lib/azure_fence.py.py b/lib/azure_fence.py.py
index fcbc40ab..5b26bd34 100644
--- a/lib/azure_fence.py.py
+++ b/lib/azure_fence.py.py
@@ -14,6 +14,8 @@ FENCE_TAG_IP = "FENCE_TAG_IP"
 IP_TYPE_DYNAMIC = "Dynamic"
 MAX_RETRY = 10
 RETRY_WAIT = 5
+COMPUTE_CLIENT_API_VERSION = "2021-11-01"
+NETWORK_MGMT_CLIENT_API_VERSION = "2021-05-01"
 
 class AzureSubResource:
     Type = None
@@ -366,17 +368,20 @@ def get_azure_compute_client(config):
                 base_url=cloud_environment.endpoints.resource_manager,
                 profile=client_profile,
                 credential_scopes=[credential_scope],
+                api_version=COMPUTE_CLIENT_API_VERSION
             )
         except TypeError:
             compute_client = ComputeManagementClient(
                 credentials,
                 config.SubscriptionId,
-                base_url=cloud_environment.endpoints.resource_manager
+                base_url=cloud_environment.endpoints.resource_manager,
+                api_version=COMPUTE_CLIENT_API_VERSION
             )
     else:
         compute_client = ComputeManagementClient(
             credentials,
-            config.SubscriptionId
+            config.SubscriptionId,
+            api_version=COMPUTE_CLIENT_API_VERSION
         )
     return compute_client
 
@@ -404,16 +409,19 @@ def get_azure_network_client(config):
                 base_url=cloud_environment.endpoints.resource_manager,
                 profile=client_profile,
                 credential_scopes=[credential_scope],
+                api_version=NETWORK_MGMT_CLIENT_API_VERSION
             )
         except TypeError:
             network_client = NetworkManagementClient(
                 credentials,
                 config.SubscriptionId,
-                base_url=cloud_environment.endpoints.resource_manager
+                base_url=cloud_environment.endpoints.resource_manager,
+                api_version=NETWORK_MGMT_CLIENT_API_VERSION
             )
     else:
         network_client = NetworkManagementClient(
             credentials,
-            config.SubscriptionId
+            config.SubscriptionId,
+            api_version=NETWORK_MGMT_CLIENT_API_VERSION
         )
     return network_client
-- 
2.43.0

openSUSE Build Service is sponsored by