Add option for populating a dropdown list instead of the textfield for

selecting domain at the horizon login

Depends-On: https://review.openstack.org/579475
Change-Id: I67c4c8923ef4d6e4c3420e0a2b0d38ee3c6e2819
This commit is contained in:
Eigil Obrestad 2018-06-25 09:35:45 +02:00 committed by Tobias Urdin
parent 53be1db825
commit e14074e4fc
4 changed files with 47 additions and 0 deletions

View File

@ -256,6 +256,15 @@
# All entities will be created in the default domain.
# Default to undef
#
# [*keystone_domain_choices*]
# (optional) A hash of hashes to populate a dropdown for the domain field on
# the horizon login page.
# Example: [
# {'name' => 'default', 'display' => 'The default domain'},
# {'name' => 'LDAP', 'display' => 'The LDAP Catalog'},
# ]
# Defaults to undef
#
# [*image_backend*]
# (optional) Overrides the default image backend settings. This allows the list of supported
# image types etc. to be explicitly defined.
@ -472,6 +481,7 @@ class horizon(
$api_versions = {'identity' => '3'},
$keystone_multidomain_support = false,
$keystone_default_domain = undef,
$keystone_domain_choices = undef,
$image_backend = {},
$overview_days_range = undef,
$root_url = $::horizon::params::root_url,

View File

@ -0,0 +1,8 @@
---
features:
- |
Added the parameter "keystone_domain_choices" to the ::horizon class.
Setting this parameter would replace the domain text-field at the horizon
login-page with a drop-down menu. The parameter should be an array with
hashes, and the hashes should have two items each (name, display) containing
the domain name and a human-readable description of the domain respectively.

View File

@ -645,6 +645,26 @@ describe 'horizon' do
])
end
end
context 'with keystone_domain_choices' do
before do
params.merge!({
:keystone_domain_choices => [
{'name' => 'default', 'display' => 'The default domain'},
{'name' => 'LDAP', 'display' => 'The LDAP Catalog'},
],
})
end
it 'sets OPENSTACK_KEYSTONE_DOMAIN_DROPDOWN in local_settings.py' do
verify_concat_fragment_contents(catalogue, 'local_settings.py', [
'OPENSTACK_KEYSTONE_DOMAIN_DROPDOWN = True',
'OPENSTACK_KEYSTONE_DOMAIN_CHOICES = (',
" ('default', 'The default domain'),",
" ('LDAP', 'The LDAP Catalog'),",
')',
])
end
end
end
shared_examples_for 'horizon on RedHat' do

View File

@ -94,6 +94,15 @@ OPENSTACK_API_VERSIONS = {
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
<% end %>
<% if @keystone_domain_choices.kind_of?(Array) %>
OPENSTACK_KEYSTONE_DOMAIN_DROPDOWN = True
OPENSTACK_KEYSTONE_DOMAIN_CHOICES = (
<% @keystone_domain_choices.each do |d| -%>
('<%= d['name'] -%>', '<%= d['display'] -%>'),
<% end -%>
)
<% end -%>
# 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 = 'Default'