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

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