diff --git a/etc/conductor.conf b/etc/conductor.conf index 30c615b..a8b80db 100644 --- a/etc/conductor.conf +++ b/etc/conductor.conf @@ -18,6 +18,7 @@ agent_config_dir = /etc/murano/agent-config data_dir = test_data # Provide url to Murano Metadata repository +# Comment this line if you registered murano-metadata in keystone catalog murano_metadata_url = http://localhost:8084 # Maximum number of environments that can be processed simultaneously diff --git a/muranoconductor/app.py b/muranoconductor/app.py index fcc9072..fe8ee01 100644 --- a/muranoconductor/app.py +++ b/muranoconductor/app.py @@ -95,7 +95,8 @@ class ConductorWorkflowService(service.Service): reporter = reporting.Reporter(mq, message_id, task['id']) metadata_version = metadata.get_metadata(task['id'], - task['token']) + task['token'], + task['tenant_id']) command_dispatcher = CommandDispatcher('e' + task['id'], mq, task['token'], task['tenant_id'], diff --git a/muranoconductor/metadata.py b/muranoconductor/metadata.py index 68b9407..6685ce2 100644 --- a/muranoconductor/metadata.py +++ b/muranoconductor/metadata.py @@ -22,6 +22,7 @@ from metadataclient.common.exceptions import CommunicationError from muranoconductor import config from metadataclient.v1.client import Client import os +from keystoneclient.v2_0 import client as ksclient from openstack.common import log as logging CHUNK_SIZE = 1 << 20 # 1MB @@ -52,25 +53,34 @@ def _unpack_data_archive(task_id, hash): return dst_dir -def get_endpoint(): +def get_endpoint(token_id, tenant_id): endpoint = CONF.murano_metadata_url - if not endpoint: - #TODO: add keystone catalog lookup - pass + keystone_settings = CONF.keystone + + client = ksclient.Client(auth_url=keystone_settings.auth_url, + token=token_id) + + client.authenticate( + auth_url=keystone_settings.auth_url, + tenant_id=tenant_id, + token=token_id) + + endpoint = client.service_catalog.url_for( + service_type='murano-metadata') return endpoint -def metadataclient(token_id): - endpoint = get_endpoint() +def metadataclient(token_id, tenant_id): + endpoint = get_endpoint(token_id, tenant_id) return Client(endpoint=endpoint, token=token_id) -def get_metadata(task_id, token_id): +def get_metadata(task_id, token_id, tenant_id): hash = _check_existing_hash() try: log.debug('Retrieving metadata from Murano Metadata Repository') - resp, body_iter = metadataclient(token_id).\ + resp, body_iter = metadataclient(token_id, tenant_id).\ metadata_client.get_conductor_data(hash) except CommunicationError as e: if hash: