Honor OPENSTACK_ENDPOINT_TYPE in Horizon's local_settings.py

Story: 2003777
    Task: 26470

Change-Id: Idd173a9c518f99de58e63f5cc6d3b0ccae0d80a1
(cherry picked from commit 124e6827a8)
This commit is contained in:
Emmanuel MISSIAEN 2019-01-18 11:18:39 +01:00 committed by Carlos Goncalves
parent da110314af
commit 0e14846f71
1 changed files with 3 additions and 0 deletions

View File

@ -46,12 +46,15 @@ def _get_sdk_connection(request):
# get_one_cloud wants verify, so we pass 'not insecure' to verify.
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
# Pass interface to honor 'OPENSTACK_ENDPOINT_TYPE'
interface = getattr(settings, 'OPENSTACK_ENDPOINT_TYPE', 'publicURL')
# Pass load_yaml_config as this is a Django service with its own config
# and we don't want to accidentaly pick up a clouds.yaml file. We want to
# use the settings we're passing in.
cloud_config = occ.OpenStackConfig(load_yaml_config=False).get_one_cloud(
verify=not insecure,
cacert=cacert,
interface=interface,
region_name=request.user.services_region,
auth_type='token',
auth=dict(