Merge "Add service catalog lookup for metadata repository"
This commit is contained in:
commit
52151e1c6b
@ -18,6 +18,7 @@ agent_config_dir = /etc/murano/agent-config
|
|||||||
data_dir = test_data
|
data_dir = test_data
|
||||||
|
|
||||||
# Provide url to Murano Metadata repository
|
# Provide url to Murano Metadata repository
|
||||||
|
# Comment this line if you registered murano-metadata in keystone catalog
|
||||||
murano_metadata_url = http://localhost:8084
|
murano_metadata_url = http://localhost:8084
|
||||||
|
|
||||||
# Maximum number of environments that can be processed simultaneously
|
# Maximum number of environments that can be processed simultaneously
|
||||||
|
@ -95,7 +95,8 @@ class ConductorWorkflowService(service.Service):
|
|||||||
reporter = reporting.Reporter(mq, message_id, task['id'])
|
reporter = reporting.Reporter(mq, message_id, task['id'])
|
||||||
|
|
||||||
metadata_version = metadata.get_metadata(task['id'],
|
metadata_version = metadata.get_metadata(task['id'],
|
||||||
task['token'])
|
task['token'],
|
||||||
|
task['tenant_id'])
|
||||||
command_dispatcher = CommandDispatcher('e' + task['id'], mq,
|
command_dispatcher = CommandDispatcher('e' + task['id'], mq,
|
||||||
task['token'],
|
task['token'],
|
||||||
task['tenant_id'],
|
task['tenant_id'],
|
||||||
|
@ -22,6 +22,7 @@ from metadataclient.common.exceptions import CommunicationError
|
|||||||
from muranoconductor import config
|
from muranoconductor import config
|
||||||
from metadataclient.v1.client import Client
|
from metadataclient.v1.client import Client
|
||||||
import os
|
import os
|
||||||
|
from keystoneclient.v2_0 import client as ksclient
|
||||||
from openstack.common import log as logging
|
from openstack.common import log as logging
|
||||||
|
|
||||||
CHUNK_SIZE = 1 << 20 # 1MB
|
CHUNK_SIZE = 1 << 20 # 1MB
|
||||||
@ -52,25 +53,34 @@ def _unpack_data_archive(task_id, hash):
|
|||||||
return dst_dir
|
return dst_dir
|
||||||
|
|
||||||
|
|
||||||
def get_endpoint():
|
def get_endpoint(token_id, tenant_id):
|
||||||
endpoint = CONF.murano_metadata_url
|
endpoint = CONF.murano_metadata_url
|
||||||
|
|
||||||
if not endpoint:
|
if not endpoint:
|
||||||
#TODO: add keystone catalog lookup
|
keystone_settings = CONF.keystone
|
||||||
pass
|
|
||||||
|
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
|
return endpoint
|
||||||
|
|
||||||
|
|
||||||
def metadataclient(token_id):
|
def metadataclient(token_id, tenant_id):
|
||||||
endpoint = get_endpoint()
|
endpoint = get_endpoint(token_id, tenant_id)
|
||||||
return Client(endpoint=endpoint, token=token_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()
|
hash = _check_existing_hash()
|
||||||
try:
|
try:
|
||||||
log.debug('Retrieving metadata from Murano Metadata Repository')
|
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)
|
metadata_client.get_conductor_data(hash)
|
||||||
except CommunicationError as e:
|
except CommunicationError as e:
|
||||||
if hash:
|
if hash:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user