Fix ip from OS_AUTH_URL for subcloud case
IP from OS_AUTH_URL is not the oam_floating_ip for the subcloud case. TEST PLAN: [PASS] Build, install [PASS] Check if downloaded file shows correct endpoint for subcloud OS_AUTH_URL Closes-Bug: 2056782 Change-Id: I5c6b24cedf97cac3f58ddd2e78fa5d52b4e45ae0 Signed-off-by: Davi Frossard <dbarrosf@windriver.com>
This commit is contained in:
parent
f04638e8f8
commit
4bd841cf82
|
@ -85,6 +85,11 @@ def subcloud_generate_config(request, subcloud_id, data):
|
||||||
subcloud_id, **data)
|
subcloud_id, **data)
|
||||||
|
|
||||||
|
|
||||||
|
def subcloud_additional_details(request, subcloud_name):
|
||||||
|
return dcmanagerclient(request).subcloud_manager.\
|
||||||
|
subcloud_additional_details(subcloud_name)
|
||||||
|
|
||||||
|
|
||||||
# SubCloud Groups functions
|
# SubCloud Groups functions
|
||||||
class SubcloudGroup(base.APIResourceWrapper):
|
class SubcloudGroup(base.APIResourceWrapper):
|
||||||
_attrs = ['group_id', 'name', 'description', 'update_apply_type',
|
_attrs = ['group_id', 'name', 'description', 'update_apply_type',
|
||||||
|
|
|
@ -19,8 +19,10 @@
|
||||||
# only for the Identity API served through keystone.
|
# only for the Identity API served through keystone.
|
||||||
{% if region == 'SystemController' %}
|
{% if region == 'SystemController' %}
|
||||||
export OS_AUTH_URL={{ auth_url|align_auth_url }}/v{{ os_identity_api_version }}
|
export OS_AUTH_URL={{ auth_url|align_auth_url }}/v{{ os_identity_api_version }}
|
||||||
{% else %}
|
{% elif region == 'RegionOne' %}
|
||||||
export OS_AUTH_URL={{ auth_url }}/v{{ os_identity_api_version }}
|
export OS_AUTH_URL={{ auth_url }}/v{{ os_identity_api_version }}
|
||||||
|
{% else %}
|
||||||
|
export OS_AUTH_URL={% align_subcloud_auth_url auth_url %}/v{{ os_identity_api_version }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# With the addition of Keystone we have standardized on the term **project**
|
# With the addition of Keystone we have standardized on the term **project**
|
||||||
|
|
|
@ -5,12 +5,30 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
|
from starlingx_dashboard.api import dc_manager
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
AUTH_PORT = '5000'
|
||||||
|
|
||||||
|
|
||||||
|
def align_ip_port(url, ip):
|
||||||
|
url_list = url.split('//')
|
||||||
|
url_list[-1] = ip
|
||||||
|
return '//'.join(url_list) + ':' + AUTH_PORT
|
||||||
|
|
||||||
|
|
||||||
@register.filter(name="align_auth_url")
|
@register.filter(name="align_auth_url")
|
||||||
def align_auth_url(url):
|
def align_auth_url(auth_url):
|
||||||
url_list = url.split(':')
|
url_list = auth_url.split(':')
|
||||||
url_list[-1] = '5000'
|
url_list[-1] = AUTH_PORT
|
||||||
return ':'.join(url_list)
|
return ':'.join(url_list)
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag(name='align_subcloud_auth_url', takes_context=True)
|
||||||
|
def align_subcloud_auth_url(context, auth_url):
|
||||||
|
request = context["request"]
|
||||||
|
subcloud_name = request.user.services_region
|
||||||
|
request.user.services_region = 'SystemController'
|
||||||
|
result = dc_manager.subcloud_additional_details(request, subcloud_name)
|
||||||
|
subcloud_oam_floating_ip = result[0].oam_floating_ip
|
||||||
|
return align_ip_port(auth_url, subcloud_oam_floating_ip)
|
||||||
|
|
Loading…
Reference in New Issue