Add default endpoint in case it's not found in service catalog

Change-Id: Ia4a06e32eeb1738afc75b4ad6ddec9432313910a
This commit is contained in:
Ekaterina Fedorova 2013-12-10 10:18:53 +04:00
parent c0f5a3b4e4
commit 55ae7796d9
1 changed files with 11 additions and 2 deletions

View File

@ -23,6 +23,8 @@ from muranoconductor import config
from metadataclient.v1.client import Client
import os
from keystoneclient.v2_0 import client as ksclient
from keystoneclient.exceptions import EndpointNotFound
from openstack.common import log as logging
CHUNK_SIZE = 1 << 20 # 1MB
@ -66,8 +68,15 @@ def get_endpoint(token_id, tenant_id):
tenant_id=tenant_id,
token=token_id)
endpoint = client.service_catalog.url_for(
service_type='murano-metadata')
try:
endpoint = client.service_catalog.url_for(
service_type='murano-metadata')
except EndpointNotFound:
endpoint = 'http://localhost:8084/v1'
log.warning(
'Murano Metadata API location could not be found in the '
'Keystone Service Catalog, using default: {0}'.format(
endpoint))
return endpoint