From e3326b77086b3865202cff9bce95377937aa6f07 Mon Sep 17 00:00:00 2001 From: Max Kochubey Date: Wed, 3 Oct 2018 06:40:00 +0000 Subject: [PATCH] Horizon configuration to support domains dropdown An openstack-ansible deployment does not have options to set the local_settings.py params for Horizon to support Keystone V3 multiple domains dropdown menu and its variants to choose. These options in local_settings.py are: OPENSTACK_KEYSTONE_DOMAIN_CHOICES - default value to "(('Default', 'Default'))" Change-Id: I9f1b8e4c6f5b4fe2601e5ee1dacf90bded60f93d Closes-Bug: 1795788 (cherry picked from commit d86285b377221fb5522207a9da6cbfbdea4dd1e9) --- defaults/main.yml | 5 +++++ templates/horizon_local_settings.py.j2 | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 18f8d2df..679c5423 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -254,6 +254,11 @@ horizon_keystone_multidomain_dropdown: False horizon_keystone_default_domain: Default +# Option to set the available domains to choose from. This is +# a list of pairs whose first value is the domain name and the +# second is the display name. +horizon_keystone_multidomain_choices: "(('{{ horizon_keystone_default_domain }}', '{{ horizon_keystone_default_domain }}'))" + # Enable/disable v2 openrc file download in horizon. horizon_show_keystone_v2_rc: True diff --git a/templates/horizon_local_settings.py.j2 b/templates/horizon_local_settings.py.j2 index 0f618404..b13e0823 100644 --- a/templates/horizon_local_settings.py.j2 +++ b/templates/horizon_local_settings.py.j2 @@ -81,14 +81,13 @@ OPENSTACK_API_VERSIONS = { # will require user to enter the Domain name in addition to username for login. OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = {{ horizon_keystone_multidomain_support | bool }} -{% if horizon_keystone_multidomain_support | bool %} -OPENSTACK_KEYSTONE_DOMAIN_DROPDOWN = {{ horizon_keystone_multidomain_dropdown | bool }} -{% endif %} - {% if not horizon_keystone_multidomain_support | bool %} # Overrides the default domain used when running on single-domain model # with Keystone V3. All entities will be created in the default domain. OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = "{{ horizon_keystone_default_domain }}" +{% else %} +OPENSTACK_KEYSTONE_DOMAIN_DROPDOWN = {{ horizon_keystone_multidomain_dropdown | bool }} +OPENSTACK_KEYSTONE_DOMAIN_CHOICES = {{ horizon_keystone_multidomain_choices }} {% endif %} {% endif %}