Comment 6 for bug 1064822

Revision history for this message
Svetlana Shturm (sshturm) wrote :

Also you must change /opt/stack/horizon/horizon/api/base.py
def url_for(request, service_type, admin=False, endpoint_type=None):
    endpoint_type = endpoint_type or getattr(settings,
                                             'OPENSTACK_ENDPOINT_TYPE',
                                             'publicURL')
+ region_name = request.session.get('region_name')
    catalog = request.user.service_catalog
    service = get_service_from_catalog(catalog, service_type)
    if service:
        try:
            if admin:
- return service['endpoints'][0]['adminURL']
+ for endpoint in service['endpoints']:
+ if endpoint['region'] == region_name:
+ return endpoint['adminURL']
            else:
- return service['endpoints'][0][endpoint_type]
+ for endpoint in service['endpoints']:
+ if endpoint['region'] == region_name:
+ return endpoint[endpoint_type]
            raise ValueError(region_name)
        except (IndexError, KeyError):
            raise exceptions.ServiceCatalogException(service_type)
    else:
        raise exceptions.ServiceCatalogException(service_type)