示例#1
0
文件: catalog.py 项目: toby82/murano
 def _get_glare_url(self, request):
     sc = request.context.service_catalog
     token = request.context.auth_token
     try:
         return service_catalog.ServiceCatalogV2({
             'serviceCatalog': sc
         }).url_for(service_type='artifact',
                    endpoint_type=CONF.glare.endpoint_type,
                    region_name=CONF.home_region)
     except keystone_ex.EndpointNotFound:
         return service_catalog.ServiceCatalogV3(token, {
             'catalog': sc
         }).url_for(service_type='artifact',
                    endpoint_type=CONF.glare.endpoint_type,
                    region_name=CONF.home_region)
示例#2
0
文件: base.py 项目: ekasitk/sahara
def url_for(service_catalog=None, service_type='identity',
            endpoint_type='publicURL'):
    if not service_catalog:
        service_catalog = context.current().service_catalog
    try:
        return keystone_service_catalog.ServiceCatalogV2(
            {'serviceCatalog': json.loads(service_catalog)}).url_for(
                service_type=service_type, endpoint_type=endpoint_type,
                region_name=CONF.os_region_name)
    except keystone_ex.EndpointNotFound:
        ctx = context.current()
        return keystone_service_catalog.ServiceCatalogV3(
            ctx.auth_token,
            {'catalog': json.loads(service_catalog)}).url_for(
                service_type=service_type, endpoint_type=endpoint_type,
                region_name=CONF.os_region_name)