Change Adjutant UI to use the correct service type

Keep a fallback to the old one to ease migrations.

Change-Id: Ic7e1e554a3c4197a09fe52f01fadcc10ccb534cc
This commit is contained in:
Adrian Turjak 2020-02-19 15:26:18 +13:00
parent b014b2e49f
commit 5d34774f0a
3 changed files with 13 additions and 6 deletions

View File

@ -21,6 +21,7 @@ from urllib.parse import urljoin
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon.utils import functions as utils
from horizon.utils import memoized
@ -159,9 +160,15 @@ def _get_endpoint_url(request):
# If the request is made by an anonymous user, this endpoint request fails.
# Thus, we must hardcode this in Horizon.
if getattr(request.user, "service_catalog", None):
url = base.url_for(request, service_type='registration')
try:
url = base.url_for(request, service_type='admin-logic')
except exceptions.ServiceCatalogException:
url = base.url_for(request, service_type='registration')
else:
url = getattr(settings, 'OPENSTACK_REGISTRATION_URL')
try:
url = getattr(settings, 'OPENSTACK_ADJUTANT_URL')
except AttributeError:
url = getattr(settings, 'OPENSTACK_REGISTRATION_URL')
# Ensure ends in slash
if not url.endswith('/'):

View File

@ -1,14 +1,14 @@
Configuring Adjutant-UI
=======================
Adjutant-ui relies solely on the ``OPENSTACK_REGISTRATION_URL`` setting, as
much like Keystone's url, this is needed before the user is authenticated and a
Adjutant-ui relies on the ``OPENSTACK_ADJUTANT_URL`` setting, as much
like Keystone's url, this is needed before the user is authenticated and a
valid catalog has been returned. This url is used for the password reset
functionality, and signup if that panel is turned on.
.. code-block:: python
OPENSTACK_REGISTRATION_URL = "http://127.0.0.1:5050/v1"
OPENSTACK_ADJUTANT_URL = "http://127.0.0.1:5050/v1"
Beyond that all the other settings are optional, with reasonably sensible

View File

@ -19,7 +19,7 @@ Open up the copied ``local_settings.py`` file in your preferred text
editor. You will want to customize several settings:
- Verify that the ``OPENSTACK_KEYSTONE_URL`` is correct for your environment.
- ``OPENSTACK_REGISTRATION_URL`` should also be configured to point to your
- ``OPENSTACK_ADJUTANT_URL`` should also be configured to point to your
Adjutant server and version.
You will also need to update the ``keystone_policy.json`` file in horizon with