From 6d6c5431cb417c92bbef4c78961954fa372d0a84 Mon Sep 17 00:00:00 2001 From: Lingxian Kong Date: Sat, 16 Jan 2016 23:21:22 +1300 Subject: [PATCH] Use proper way to initialize nova client Avoid the warning message below: UserWarning: 'get_client_class' is deprecated. Please use `novaclient.client.Client` instead. Change-Id: I8483241aa8021b46acdc509bd60df31233c95cf5 --- mistral/actions/openstack/actions.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mistral/actions/openstack/actions.py b/mistral/actions/openstack/actions.py index f592654b7..9b31aa85e 100644 --- a/mistral/actions/openstack/actions.py +++ b/mistral/actions/openstack/actions.py @@ -38,8 +38,6 @@ CONF = cfg.CONF class NovaAction(base.OpenStackAction): - _client_class = novaclient.get_client_class(2) - def _get_client(self): ctx = context.ctx() @@ -48,7 +46,8 @@ class NovaAction(base.OpenStackAction): keystone_endpoint = keystone_utils.get_keystone_endpoint_v2() nova_endpoint = keystone_utils.get_endpoint_for_project('nova') - client = self._client_class( + client = novaclient.Client( + 2, username=None, api_key=None, endpoint_type='publicURL', @@ -66,6 +65,10 @@ class NovaAction(base.OpenStackAction): return client + @classmethod + def _get_fake_client(cls): + return novaclient.Client(2) + class GlanceAction(base.OpenStackAction): _client_class = glanceclient.Client