Stop replacing whole HORIZON_CONFIG dict

... so that we can leverage the default items defined in horizon.

Change-Id: I6242f8cb48e51892476ead2f764d7d2c96d11448
This commit is contained in:
Takashi Kajinami 2023-02-16 12:17:22 +09:00
parent 4f3e975a9e
commit 08acafc46b
3 changed files with 15 additions and 95 deletions

View File

@ -525,19 +525,7 @@ describe 'horizon' do
verify_concat_fragment_contents(catalogue, 'local_settings.py', [
'# Custom local_settings.py',
'DEBUG = True',
"HORIZON_CONFIG = {",
" 'user_home': 'openstack_dashboard.views.get_user_home',",
" 'ajax_queue_limit': 10,",
" 'auto_fade_alerts': {",
" 'delay': 3000,",
" 'fade_duration': 1500,",
" 'types': ['alert-success', 'alert-info']",
" },",
" 'help_url': \"https://docs.openstack.org\",",
" 'exceptions': {'recoverable': exceptions.RECOVERABLE,",
" 'not_found': exceptions.NOT_FOUND,",
" 'unauthorized': exceptions.UNAUTHORIZED},",
"}",
'HORIZON_CONFIG["help_url"] = "https://docs.openstack.org"',
])
end
end
@ -695,61 +683,18 @@ describe 'horizon' do
end
end
context 'with customization_module provided' do
context 'with help_url and customization_module provided' do
before do
params.merge!({
:help_url => 'https://docs.openstack.org',
:customization_module => 'my_project.overrides',
:local_settings_template => fixtures_path + '/override_local_settings.py.erb'
:help_url => 'https://docs.openstack.org',
:customization_module => 'my_project.overrides',
})
end
it 'uses the custom local_settings.py template' do
it 'configures both options' do
verify_concat_fragment_contents(catalogue, 'local_settings.py', [
'# Custom local_settings.py',
"HORIZON_CONFIG = {",
" 'user_home': 'openstack_dashboard.views.get_user_home',",
" 'ajax_queue_limit': 10,",
" 'auto_fade_alerts': {",
" 'delay': 3000,",
" 'fade_duration': 1500,",
" 'types': ['alert-success', 'alert-info']",
" },",
" 'help_url': \"https://docs.openstack.org\",",
" 'exceptions': {'recoverable': exceptions.RECOVERABLE,",
" 'not_found': exceptions.NOT_FOUND,",
" 'unauthorized': exceptions.UNAUTHORIZED},",
" 'customization_module': 'my_project.overrides',",
"}",
])
end
end
context 'with customization_module empty' do
before do
params.merge!({
:help_url => 'https://docs.openstack.org',
:customization_module => '',
:local_settings_template => fixtures_path + '/override_local_settings.py.erb'
})
end
it 'uses the custom local_settings.py template' do
verify_concat_fragment_contents(catalogue, 'local_settings.py', [
'# Custom local_settings.py',
"HORIZON_CONFIG = {",
" 'user_home': 'openstack_dashboard.views.get_user_home',",
" 'ajax_queue_limit': 10,",
" 'auto_fade_alerts': {",
" 'delay': 3000,",
" 'fade_duration': 1500,",
" 'types': ['alert-success', 'alert-info']",
" },",
" 'help_url': \"https://docs.openstack.org\",",
" 'exceptions': {'recoverable': exceptions.RECOVERABLE,",
" 'not_found': exceptions.NOT_FOUND,",
" 'unauthorized': exceptions.UNAUTHORIZED},",
"}",
'HORIZON_CONFIG["help_url"] = "https://docs.openstack.org"',
'HORIZON_CONFIG["customization_module"] = "my_project.overrides"',
])
end
end

View File

@ -1,19 +1,4 @@
# Custom local_settings.py
DEBUG = <%= @django_debug %>
HORIZON_CONFIG = {
'user_home': 'openstack_dashboard.views.get_user_home',
'ajax_queue_limit': 10,
'auto_fade_alerts': {
'delay': 3000,
'fade_duration': 1500,
'types': ['alert-success', 'alert-info']
},
'help_url': "<%= @help_url %>",
'exceptions': {'recoverable': exceptions.RECOVERABLE,
'not_found': exceptions.NOT_FOUND,
'unauthorized': exceptions.UNAUTHORIZED},
<% if @customization_module and ! (@customization_module.empty?) -%>
'customization_module': '<%= @customization_module -%>',
<% end -%>
}
HORIZON_CONFIG["help_url"] = "<%= @help_url %>"

View File

@ -127,24 +127,14 @@ OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = '<%= @keystone_default_domain %>'
# Set to None explicitly if you want to deactivate the console.
#CONSOLE_TYPE = "AUTO"
# Default OpenStack Dashboard configuration.
HORIZON_CONFIG = {
'user_home': 'openstack_dashboard.views.get_user_home',
'ajax_queue_limit': 10,
'auto_fade_alerts': {
'delay': 3000,
'fade_duration': 1500,
'types': ['alert-success', 'alert-info']
},
'help_url': "<%= @help_url %>",
'exceptions': {'recoverable': exceptions.RECOVERABLE,
'not_found': exceptions.NOT_FOUND,
'unauthorized': exceptions.UNAUTHORIZED},
<% if @customization_module and ! (@customization_module.empty?) -%>
'customization_module': '<%= @customization_module -%>',
<% end -%>
}
# URL for additional help with this site.
HORIZON_CONFIG["help_url"] = "<%= @help_url %>"
<% if @customization_module and ! (@customization_module.empty?) -%>
# The python module containing own modifications
HORIZON_CONFIG["customization_module"] = "<%= @customization_module -%>"
<% end -%>
# If provided, a "Report Bug" link will be displayed in the site header
# which links to the value of this setting (ideally a URL containing
# information on how to report issues).