Add Mistarl client to murano
Change-Id: I780a9166177db14197d2cffb28eb1aeaa0e70fa9 Implements: blueprint murano-mistral-integration
This commit is contained in:
parent
ed80169da0
commit
e5026e098c
@ -84,6 +84,13 @@ heat_opts = [
|
||||
help='Heat endpoint type.')
|
||||
]
|
||||
|
||||
mistral_opts = [
|
||||
cfg.StrOpt('endpoint_type', default='publicURL',
|
||||
help='Mistral endpoint type.'),
|
||||
cfg.StrOpt('service_type', default='workflowv2',
|
||||
help='Mistral service type.')
|
||||
]
|
||||
|
||||
neutron_opts = [
|
||||
cfg.BoolOpt('insecure', default=False,
|
||||
help='This option explicitly allows Murano to perform '
|
||||
@ -220,6 +227,7 @@ CONF.register_opts(paste_deploy_opts, group='paste_deploy')
|
||||
CONF.register_cli_opts(bind_opts)
|
||||
CONF.register_opts(rabbit_opts, group='rabbitmq')
|
||||
CONF.register_opts(heat_opts, group='heat')
|
||||
CONF.register_opts(mistral_opts, group='mistral')
|
||||
CONF.register_opts(neutron_opts, group='neutron')
|
||||
CONF.register_opts(keystone_opts, group='keystone')
|
||||
CONF.register_opts(murano_opts, group='murano')
|
||||
|
@ -15,6 +15,12 @@
|
||||
|
||||
from eventlet import semaphore
|
||||
import heatclient.client as hclient
|
||||
|
||||
try:
|
||||
import mistralclient.api.client as mistralclient
|
||||
except ImportError as mistral_import_error:
|
||||
mistralclient = None
|
||||
|
||||
import muranoclient.v1.client as muranoclient
|
||||
import neutronclient.v2_0.client as nclient
|
||||
|
||||
@ -140,3 +146,30 @@ class ClientManager(object):
|
||||
token=auth_token)
|
||||
|
||||
return self._get_client(context, 'murano', use_trusts, factory)
|
||||
|
||||
def get_mistral_client(self, context, use_trusts=True):
|
||||
if not mistralclient:
|
||||
raise mistral_import_error
|
||||
|
||||
if not config.CONF.engine.use_trusts:
|
||||
use_trusts = False
|
||||
|
||||
def factory(keystone_client, auth_token):
|
||||
mistral_settings = config.CONF.mistral
|
||||
|
||||
endpoint_type = mistral_settings.endpoint_type
|
||||
service_type = mistral_settings.service_type
|
||||
|
||||
mistral_url = keystone_client.service_catalog.url_for(
|
||||
service_type=service_type,
|
||||
endpoint_type=endpoint_type)
|
||||
|
||||
return mistralclient.client(mistral_url=mistral_url,
|
||||
auth_url=keystone_client.auth_url,
|
||||
project_id=keystone_client.tenant_id,
|
||||
endpoint_type=endpoint_type,
|
||||
service_type=service_type,
|
||||
auth_token=auth_token,
|
||||
user_id=keystone_client.user_id)
|
||||
|
||||
return self._get_client(context, 'mistral', use_trusts, factory)
|
||||
|
@ -36,3 +36,4 @@ oslo.utils>=1.1.0 # Apache-2.0
|
||||
# not listed in global requirements
|
||||
yaql>=0.2.3,<0.3
|
||||
python-muranoclient>=0.5.5
|
||||
python-mistralclient>=0.1.1
|
||||
|
Loading…
Reference in New Issue
Block a user