- fence_azure_arm: fix MSI issue

Resolves: RHEL-76492
This commit is contained in:
Oyvind Albrigtsen 2025-01-30 15:34:13 +01:00
parent 7bcee5217a
commit 0677f63bac
2 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
--- a/lib/azure_fence.py.py 2025-01-28 11:38:59.877243912 +0100 --- a/lib/azure_fence.py.py 2025-01-30 14:47:16.047999700 +0100
+++ b/lib/azure_fence.py.py 2025-01-28 09:54:15.746703761 +0100 +++ b/lib/azure_fence.py.py 2025-01-30 12:06:10.847889534 +0100
@@ -14,6 +14,9 @@ @@ -14,6 +14,9 @@
IP_TYPE_DYNAMIC = "Dynamic" IP_TYPE_DYNAMIC = "Dynamic"
MAX_RETRY = 10 MAX_RETRY = 10
@ -200,11 +200,11 @@
+ if config.UseMSI: + if config.UseMSI:
+ try: + try:
+ from azure.identity import ManagedIdentityCredential + from azure.identity import ManagedIdentityCredential
+ credentials = ManagedIdentityCredential(identity_config={"resource_id": cloud_environment["resource_manager"]}) + credentials = ManagedIdentityCredential(authority=cloud_environment["authority_hosts"])
+ except ImportError: + except ImportError:
+ from msrestazure.azure_active_directory import MSIAuthentication + from msrestazure.azure_active_directory import MSIAuthentication
+ credentials = MSIAuthentication(cloud_environment=cloud_environment["cloud_environment"]) + credentials = MSIAuthentication(cloud_environment=cloud_environment["cloud_environment"])
+ return + return credentials
+ +
+ try: + try:
+ # try to use new libraries ClientSecretCredential (azure.identity, based on azure.core) + # try to use new libraries ClientSecretCredential (azure.identity, based on azure.core)
@ -319,8 +319,8 @@
+ api_version=NETWORK_MGMT_CLIENT_API_VERSION + api_version=NETWORK_MGMT_CLIENT_API_VERSION
) )
return network_client return network_client
--- a/agents/azure_arm/fence_azure_arm.py 2025-01-28 11:38:59.880243982 +0100 --- a/agents/azure_arm/fence_azure_arm.py 2025-01-30 15:28:35.889163377 +0100
+++ b/agents/azure_arm/fence_azure_arm.py 2025-01-28 11:43:16.290189381 +0100 +++ b/agents/azure_arm/fence_azure_arm.py 2025-01-30 15:28:52.190553135 +0100
@@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
sys.path.append("@FENCEAGENTSLIBDIR@") sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import * from fencing import *

View File

@ -87,7 +87,7 @@
Name: fence-agents Name: fence-agents
Summary: Set of unified programs capable of host isolation ("fencing") Summary: Set of unified programs capable of host isolation ("fencing")
Version: 4.2.1 Version: 4.2.1
Release: 129%{?alphatag:.%{alphatag}}%{?dist}.6 Release: 129%{?alphatag:.%{alphatag}}%{?dist}.7
License: GPLv2+ and LGPLv2+ License: GPLv2+ and LGPLv2+
Group: System Environment/Base Group: System Environment/Base
URL: https://github.com/ClusterLabs/fence-agents URL: https://github.com/ClusterLabs/fence-agents
@ -1595,7 +1595,7 @@ Fence agent for IBM z/VM over IP.
%endif %endif
%changelog %changelog
* Wed Jan 29 2025 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.2.1-129.6 * Thu Jan 30 2025 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.2.1-129.7
- fence_azure_arm: use azure-identity instead of msrestazure, which has - fence_azure_arm: use azure-identity instead of msrestazure, which has
been deprecated been deprecated
Resolves: RHEL-76492 Resolves: RHEL-76492