From dfcbcafdd3a5b948ea4bb31961be41cc91b08290 Mon Sep 17 00:00:00 2001 From: akrzos Date: Tue, 19 Dec 2017 10:47:58 -0500 Subject: [PATCH] Can not create Gnocchi client due to deprecated session options With Gnocchiclient 4.0.0 session options have been deprecated. Thus passing service_type into the client will cause an exception. We can pass in adapter_options with the service_type specified though. See this Gnocchi client change: https://github.com/gnocchixyz/python-gnocchiclient/pull/23 Change-Id: Ib697bc115aee9c61ae30a5449a561178f3a65663 --- rally/plugins/openstack/osclients.py | 5 +++-- tests/unit/plugins/openstack/test_osclients.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rally/plugins/openstack/osclients.py b/rally/plugins/openstack/osclients.py index e8cdd84a..854b83fa 100644 --- a/rally/plugins/openstack/osclients.py +++ b/rally/plugins/openstack/osclients.py @@ -512,8 +512,9 @@ class Gnocchi(OSClient): service_type = self.choose_service_type(service_type) sess = self.keystone.get_session()[0] - gclient = gnocchi.Client(version=self.choose_version( - version), session=sess, service_type=service_type) + gclient = gnocchi.Client( + version=self.choose_version(version), session=sess, + adapter_options={"service_type": service_type}) return gclient diff --git a/tests/unit/plugins/openstack/test_osclients.py b/tests/unit/plugins/openstack/test_osclients.py index 40b0100d..eaf42939 100644 --- a/tests/unit/plugins/openstack/test_osclients.py +++ b/tests/unit/plugins/openstack/test_osclients.py @@ -618,7 +618,7 @@ class OSClientsTestCase(test.TestCase): self.assertEqual(fake_gnocchi, client) kw = {"version": "1", "session": mock_keystoneauth1.session.Session(), - "service_type": "metric"} + "adapter_options": {"service_type": "metric"}} mock_gnocchi.client.Client.assert_called_once_with(**kw) self.assertEqual(fake_gnocchi, self.clients.cache["gnocchi"])