Add service catalog lookup for metadata repository

Change-Id: I44ba8d88c10f21de5afa28803bfc3dc0db8f9923
This commit is contained in:
Ekaterina Fedorova 2013-11-26 19:48:24 +04:00
parent 214b457636
commit cafaea487e
4 changed files with 22 additions and 10 deletions

View File

@ -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

View File

@ -90,7 +90,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'],

View File

@ -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:

View File

@ -14,5 +14,5 @@ deep
# Please, revert to murano-common>=x.x.x before release
http://tarballs.openstack.org/murano-common/murano-common-master.tar.gz#egg=murano-common-0.4
PyYAML>=3.1.0
murano-metadataclient==0.4.a13.gd65dfd2
murano-metadataclient==0.4.dev28.g6d64a2b
python-neutronclient>=2.3.1