File 0001-fence_azure_arm-fix-get-virtual-machines-call.patch of Package fence-agents.36664
--- fence-agents-4.13.1+git.1704296072.32469f29/agents/azure_arm/fence_azure_arm.py 2024-01-03 16:34:32.000000000 +0100
+++ b/agents/azure_arm/fence_azure_arm.py 2024-07-05 12:39:14.954750870 +0200
@@ -1,5 +1,18 @@
-#!@PYTHON@ -tt
+#!/bin/sh
+# Next line is bilingual: it starts a comment in Python, and is a no-op in shell
+""":"
+
+# Find a suitable python interpreter. Look for python3.11 first and fallback to python otherwise
+for cmd in python3.11 python3 python ; do
+ command -v > /dev/null $cmd && exec $cmd $0 "$@"
+done
+
+echo "python not found" >2
+
+exit 1
+
+":"""
import sys, re, pexpect
import logging
import atexit
@@ -72,9 +85,12 @@
powerState = "unknown"
try:
- vmStatus = compute_client.virtual_machines.get(rgName, vmName, expand="instanceView")
+ vmStatus = compute_client.virtual_machines.get(rgName, vmName, "instanceView")
except Exception as e:
- fail_usage("Failed: %s" % e)
+ try:
+ vmStatus = compute_client.virtual_machines.get(rgName, vmName, expand="instanceView")
+ except Exception as e:
+ fail_usage("Failed: %s" % e)
for status in vmStatus.instance_view.statuses:
if status.code.startswith("PowerState"):