Merge "Fix senlinclient plugin"

This commit is contained in:
Zuul 2018-01-31 11:26:43 +00:00 committed by Gerrit Code Review
commit 9e4cda46e6

View File

@ -17,9 +17,8 @@ from heat.engine.clients import client_plugin
from heat.engine import constraints from heat.engine import constraints
from openstack import profile from openstack import profile
from openstack import session
from senlinclient import client
from senlinclient.common import exc from senlinclient.common import exc
from senlinclient.v1 import client
CLIENT_NAME = 'senlin' CLIENT_NAME = 'senlin'
@ -27,18 +26,15 @@ CLIENT_NAME = 'senlin'
class SenlinClientPlugin(client_plugin.ClientPlugin): class SenlinClientPlugin(client_plugin.ClientPlugin):
service_types = [CLUSTERING] = ['clustering'] service_types = [CLUSTERING] = ['clustering']
VERSION = '1'
def _create(self): def _create(self):
interface = self._get_client_option(CLIENT_NAME, 'endpoint_type') interface = self._get_client_option(CLIENT_NAME, 'endpoint_type')
prof = profile.Profile() prof = profile.Profile()
prof.set_interface(self.CLUSTERING, interface) prof.set_interface(self.CLUSTERING, interface)
prof.set_region(self.CLUSTERING, self._get_region_name()) prof.set_region(self.CLUSTERING, self._get_region_name())
keystone_session = self.context.keystone_session key_session = self.context.keystone_session
s = session.Session(session=keystone_session, return client.Client(prof=prof,
auth=keystone_session.auth, authenticator=key_session.auth)
profile=prof)
return client.Client(self.VERSION, session=s)
def generate_spec(self, spec_type, spec_props): def generate_spec(self, spec_type, spec_props):
spec = {'properties': spec_props} spec = {'properties': spec_props}