From e950254285ad408096bfc2aeba7ef359803e8b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=A1gr?= Date: Tue, 15 Aug 2017 14:54:14 +0200 Subject: [PATCH] python-novaclient-7.1.2+ compatibility patch - enabled to override api version from CLI - stopped using positional parameters - moved from tenant to project terminology Change-Id: If68c95d36f7d073fba0072bfabf3c81d8746ca38 --- monitoring-for-openstack/oschecks/utils.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/monitoring-for-openstack/oschecks/utils.py b/monitoring-for-openstack/oschecks/utils.py index d43340e..4febf19 100644 --- a/monitoring-for-openstack/oschecks/utils.py +++ b/monitoring-for-openstack/oschecks/utils.py @@ -120,7 +120,7 @@ class Nova(object): self.nova.parser = self.nova.get_base_parser(self.base_argv) self.add_argument = self.nova.parser.add_argument - def setup(self): + def setup(self, api_version='2.1'): from novaclient.client import Client (options, args) = self.nova.parser.parse_known_args(self.base_argv) if options.help: @@ -128,18 +128,21 @@ class Nova(object): self.nova.do_help(options) sys.exit(2) auth_token = getattr(args, 'os_token', None) - api_version = '2.1' + api_version = ( + getattr(options, 'os_compute_api_version', api_version) or + api_version + ) try: nova_client = Client( api_version, - options.os_username, - options.os_password, - getattr( + username=options.os_username, + password=options.os_password, + project_name=getattr( options, 'os_project_name', getattr( options, 'os_tenant_name', None ) ), - tenant_id=getattr( + project_id=getattr( options, 'os_project_id', getattr( options, 'os_tenant_id', None )