Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Maintenance:8763
fence-agents.openSUSE_Leap_42.3_Update
0009-Compute-Handle-differences-in-Nova-API-arg...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0009-Compute-Handle-differences-in-Nova-API-argument-pass.patch of Package fence-agents.openSUSE_Leap_42.3_Update
From 88c1542454b1527fb24a7b3722fd1bf892b5ce07 Mon Sep 17 00:00:00 2001 From: Andrew Beekhof <andrew@beekhof.net> Date: Mon, 10 Jul 2017 10:53:29 +1000 Subject: [PATCH 09/14] Compute: Handle differences in Nova API argument passing --- fence/agents/compute/fence_compute.py | 50 ++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/fence/agents/compute/fence_compute.py b/fence/agents/compute/fence_compute.py index 907b9c1c..a988324c 100644 --- a/fence/agents/compute/fence_compute.py +++ b/fence/agents/compute/fence_compute.py @@ -4,6 +4,7 @@ import sys import time import atexit import logging +import inspect import requests.exceptions sys.path.append("@FENCEAGENTSLIBDIR@") @@ -310,15 +311,46 @@ def create_nova_connection(options): versions = [ "2.11", "2" ] for version in versions: - nova = client.Client(version, - options["--username"], - options["--password"], - options["--tenant-name"], - options["--auth-url"], - insecure=options["--insecure"], - region_name=options["--region-name"], - endpoint_type=options["--endpoint-type"], - http_log_debug=options.has_key("--verbose")) + clientargs = inspect.getargspec(client.Client).varargs + + # Some versions of Openstack prior to Ocata only + # supported positional arguments for username, + # password and tenant. + # + # Versions since Ocata only support named arguments. + # + # So we need to use introspection to figure out how to + # create a Nova client. + # + # Happy days + # + if clientargs: + # OSP < 11 + # ArgSpec(args=['version', 'username', 'password', 'project_id', 'auth_url'], + # varargs=None, + # keywords='kwargs', defaults=(None, None, None, None)) + nova = client.Client(version, + options["--username"], + options["--password"], + options["--tenant-name"], + options["--auth-url"], + insecure=options["--insecure"], + region_name=options["--region-name"], + endpoint_type=options["--endpoint-type"], + http_log_debug=options.has_key("--verbose")) + else: + # OSP >= 11 + # ArgSpec(args=['version'], varargs='args', keywords='kwargs', defaults=None) + nova = client.Client(version, + username=options["--username"], + password=options["--password"], + tenant_name=options["--tenant-name"], + auth_url=options["--auth-url"], + insecure=options["--insecure"], + region_name=options["--region-name"], + endpoint_type=options["--endpoint-type"], + http_log_debug=options.has_key("--verbose")) + try: nova.hypervisors.list() return -- 2.13.6
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor