fence-agents/0002-fence_compute-Keep-compatibility-with-python-novacli.patch
Kristoffer Gronlund db0d731e53 - Update to version 4.0.24:
* Improve obtaining status on Cisco UCS devices
  * Fix issues with symlink installations
  * Fix documentation for fence_scsi and fence_mpath

OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/fence-agents?expand=0&rev=54
2016-08-26 13:59:46 +00:00

47 lines
1.3 KiB
Diff

From 1abc140ed7fabff1120dc45527f664aeac0dc4f6 Mon Sep 17 00:00:00 2001
From: Vincent Untz <vuntz@suse.com>
Date: Wed, 23 Mar 2016 11:03:24 +0100
Subject: [PATCH 2/9] fence_compute: Keep compatibility with python-novaclient
<= 2.26.0
---
fence/agents/compute/fence_compute.py | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/fence/agents/compute/fence_compute.py b/fence/agents/compute/fence_compute.py
index f024aa5..07639cc 100644
--- a/fence/agents/compute/fence_compute.py
+++ b/fence/agents/compute/fence_compute.py
@@ -412,7 +412,12 @@ def main():
run_delay(options)
try:
- from novaclient import client as nova_client
+ from distutils.version import LooseVersion
+ except ImportError:
+ fail_usage("distutils not found or not accessible")
+
+ try:
+ import novaclient
except ImportError:
fail_usage("nova not found or not accessible")
@@ -433,8 +438,12 @@ def main():
elif options["--action"] in ["monitor", "status"]:
sys.exit(0)
- # The first argument is the Nova client version
- nova = nova_client.Client('2.11',
+ if LooseVersion(novaclient.__version__) <= LooseVersion('2.26.0') :
+ api_version = '2'
+ else:
+ api_version = '2.11'
+
+ nova = novaclient.client.Client(api_version,
options["--username"],
options["--password"],
options["--tenant-name"],
--
2.9.0