Blame SOURCES/bz1957762-fence_azure_arm-fix-MSI-support.patch

395151
From 2c9ee29d1e28dbdd5e305156ae70451e31d976c0 Mon Sep 17 00:00:00 2001
395151
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
395151
Date: Thu, 4 Jun 2020 14:43:15 +0200
395151
Subject: [PATCH 1/2] fence_azure_arm: log metadata when debugging
395151
395151
---
395151
 lib/azure_fence.py.py | 1 +
395151
 1 file changed, 1 insertion(+)
395151
395151
diff --git a/lib/azure_fence.py.py b/lib/azure_fence.py.py
395151
index 7bb43adc..4e44ca9d 100644
395151
--- a/lib/azure_fence.py.py
395151
+++ b/lib/azure_fence.py.py
395151
@@ -41,6 +41,7 @@ def get_from_metadata(parameter):
395151
     import requests
395151
     try:
395151
         r = requests.get('http://169.254.169.254/metadata/instance?api-version=2017-08-01', headers = {"Metadata":"true"})
395151
+        logging.debug("metadata: " + str(r.json()))
395151
         return str(r.json()["compute"][parameter])
395151
     except:
395151
         logging.warning("Not able to use metadata service. Am I running in Azure?")
395151
395151
From e3e3199cbf35855c6ab512ac06d7249df94eb3e7 Mon Sep 17 00:00:00 2001
395151
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
395151
Date: Thu, 4 Jun 2020 14:43:52 +0200
395151
Subject: [PATCH 2/2] fence_azure_arm: fixes to make MSI support work
395151
395151
---
395151
 agents/azure_arm/fence_azure_arm.py     | 3 ++-
395151
 tests/data/metadata/fence_azure_arm.xml | 4 ++--
395151
 2 files changed, 4 insertions(+), 3 deletions(-)
395151
395151
diff --git a/agents/azure_arm/fence_azure_arm.py b/agents/azure_arm/fence_azure_arm.py
395151
index be0d4034..6b1a3770 100755
395151
--- a/agents/azure_arm/fence_azure_arm.py
395151
+++ b/agents/azure_arm/fence_azure_arm.py
395151
@@ -184,7 +184,7 @@ def main():
395151
     compute_client = None
395151
     network_client = None
395151
 
395151
-    device_opt = ["login", "passwd", "port", "resourceGroup", "tenantId", "subscriptionId", "network-fencing", "msi", "cloud"]
395151
+    device_opt = ["login", "no_login", "no_password", "passwd", "port", "resourceGroup", "tenantId", "subscriptionId", "network-fencing", "msi", "cloud"]
395151
 
395151
     atexit.register(atexit_handler)
395151
 
395151
@@ -222,6 +222,7 @@ def main():
395151
 
395151
     try:
395151
         config = azure_fence.get_azure_config(options)
395151
+        options["--resourceGroup"] = config.RGName
395151
         compute_client = azure_fence.get_azure_compute_client(config)
395151
         if "--network-fencing" in options:
395151
             network_client = azure_fence.get_azure_network_client(config)
395151
diff --git a/tests/data/metadata/fence_azure_arm.xml b/tests/data/metadata/fence_azure_arm.xml
395151
index 97ecfdba..7ea672af 100644
395151
--- a/tests/data/metadata/fence_azure_arm.xml
395151
+++ b/tests/data/metadata/fence_azure_arm.xml
395151
@@ -23,7 +23,7 @@ When using network fencing the reboot-action will cause a quick-return once the
395151
 		<content type="string" default="reboot"  />
395151
 		<shortdesc lang="en">Fencing action</shortdesc>
395151
 	</parameter>
395151
-	<parameter name="login" unique="0" required="1" deprecated="1">
395151
+	<parameter name="login" unique="0" required="0" deprecated="1">
395151
 		<getopt mixed="-l, --username=[appid]" />
395151
 		<content type="string"  />
395151
 		<shortdesc lang="en">Application ID</shortdesc>
395151
@@ -58,7 +58,7 @@ When using network fencing the reboot-action will cause a quick-return once the
395151
 		<content type="string"  />
395151
 		<shortdesc lang="en">Physical plug number on device, UUID or identification of machine</shortdesc>
395151
 	</parameter>
395151
-	<parameter name="username" unique="0" required="1" obsoletes="login">
395151
+	<parameter name="username" unique="0" required="0" obsoletes="login">
395151
 		<getopt mixed="-l, --username=[appid]" />
395151
 		<content type="string"  />
395151
 		<shortdesc lang="en">Application ID</shortdesc>