Allow added sections to local_settings template
Similar design to the multi backend support in block-storage. Change-Id: I6d715975429346190eb054a713c317be132656e6 Closes-Bug: #1358817
This commit is contained in:
parent
5ed97b396d
commit
53e38b80b9
|
@ -7,6 +7,7 @@ This file is used to list changes made in each version of the openstack-dashboar
|
||||||
* Upgrading berkshelf from 2.0.18 to 3.1.5
|
* Upgrading berkshelf from 2.0.18 to 3.1.5
|
||||||
* Allow enable_filewall and enable_vpn to be configured via attributes
|
* Allow enable_filewall and enable_vpn to be configured via attributes
|
||||||
* Sync conf files with Juno
|
* Sync conf files with Juno
|
||||||
|
* Add optional section support for local_settings template
|
||||||
|
|
||||||
## 9.1
|
## 9.1
|
||||||
* python_packages database client attributes have been moved to the -common cookbook
|
* python_packages database client attributes have been moved to the -common cookbook
|
||||||
|
|
|
@ -47,6 +47,7 @@ Attributes
|
||||||
* `openstack['dashboard']['http_port']` - Port that httpd should listen on (default: 80)
|
* `openstack['dashboard']['http_port']` - Port that httpd should listen on (default: 80)
|
||||||
* `openstack['dashboard']['https_port']` - Port that httpd should listen on for using ssl (default: 443)
|
* `openstack['dashboard']['https_port']` - Port that httpd should listen on for using ssl (default: 443)
|
||||||
* `openstack['dashboard']['password_autocomplete']` - Toggle browser autocompletion for login form ('on' or 'off', default: 'on')
|
* `openstack['dashboard']['password_autocomplete']` - Toggle browser autocompletion for login form ('on' or 'off', default: 'on')
|
||||||
|
* `openstack['dashboard']['misc_local_settings']` - Additions to the local_settings conf file
|
||||||
|
|
||||||
Identity
|
Identity
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -178,3 +178,25 @@ default['openstack']['dashboard']['neutron']['enable_lb'] = false
|
||||||
default['openstack']['dashboard']['neutron']['enable_quotas'] = true
|
default['openstack']['dashboard']['neutron']['enable_quotas'] = true
|
||||||
default['openstack']['dashboard']['neutron']['enable_firewall'] = false
|
default['openstack']['dashboard']['neutron']['enable_firewall'] = false
|
||||||
default['openstack']['dashboard']['neutron']['enable_vpn'] = false
|
default['openstack']['dashboard']['neutron']['enable_vpn'] = false
|
||||||
|
|
||||||
|
# Allow for misc sections to be added to the local_settings template
|
||||||
|
# For example: {
|
||||||
|
# 'CUSTOM_CONFIG_A' => {
|
||||||
|
# 'variable1': 'value1',
|
||||||
|
# 'variable2': 'value2'
|
||||||
|
# }
|
||||||
|
# 'CUSTOM_CONFIG_B' => {
|
||||||
|
# 'variable1': 'value1',
|
||||||
|
# 'variable2': 'value2'
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# will generate:
|
||||||
|
# CUSTOM_CONFIG_A = {
|
||||||
|
# 'varable1': 'value1',
|
||||||
|
# 'varable2': 'value2',
|
||||||
|
# }
|
||||||
|
# CUSTOM_CONFIG_A = {
|
||||||
|
# 'varable1': 'value1',
|
||||||
|
# 'varable2': 'value2',
|
||||||
|
# }
|
||||||
|
default['openstack']['dashboard']['misc_local_settings'] = nil
|
||||||
|
|
|
@ -98,6 +98,36 @@ describe 'openstack-dashboard::server' do
|
||||||
expect(chef_run).to render_file(file.name).with_content(/^custom_template_banner_value$/)
|
expect(chef_run).to render_file(file.name).with_content(/^custom_template_banner_value$/)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'misc settings' do
|
||||||
|
before do
|
||||||
|
node.set['openstack']['dashboard']['misc_local_settings'] = {
|
||||||
|
'CUSTOM_CONFIG_A' => {
|
||||||
|
'variable1' => 'value1',
|
||||||
|
'variable2' => 'value2'
|
||||||
|
},
|
||||||
|
'CUSTOM_CONFIG_B' => {
|
||||||
|
'variable1' => 'value1',
|
||||||
|
'variable2' => 'value2'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'sets misc settings properly' do
|
||||||
|
[
|
||||||
|
['CUSTOM_CONFIG_A = {',
|
||||||
|
' \'variable1\': \'value1\',',
|
||||||
|
' \'variable2\': \'value2\',',
|
||||||
|
'}'],
|
||||||
|
['CUSTOM_CONFIG_B = {',
|
||||||
|
' \'variable1\': \'value1\',',
|
||||||
|
' \'variable2\': \'value2\',',
|
||||||
|
'}']
|
||||||
|
].each do |content|
|
||||||
|
expect(chef_run).to render_file(file.name).with_content(build_section(content))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'debug setting' do
|
context 'debug setting' do
|
||||||
context 'set to true' do
|
context 'set to true' do
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -21,6 +21,12 @@ SUSE_OPTS = {
|
||||||
log_level: LOG_LEVEL
|
log_level: LOG_LEVEL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Build a regex for a section of lines
|
||||||
|
def build_section(lines)
|
||||||
|
lines.map! { |line| Regexp.quote(line) }
|
||||||
|
/^#{lines.join('\n')}/
|
||||||
|
end
|
||||||
|
|
||||||
shared_context 'dashboard_stubs' do
|
shared_context 'dashboard_stubs' do
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(Chef::Recipe).to receive(:memcached_servers)
|
allow_any_instance_of(Chef::Recipe).to receive(:memcached_servers)
|
||||||
|
|
|
@ -589,3 +589,15 @@ mod = sys.modules['openstack_dashboard.settings']
|
||||||
mod.INSTALLED_APPS += ('<%= p %>', )
|
mod.INSTALLED_APPS += ('<%= p %>', )
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
# Allow for misc sections to be added
|
||||||
|
<% if node["openstack"]["dashboard"]["misc_local_settings"] %>
|
||||||
|
<% node["openstack"]["dashboard"]["misc_local_settings"].each do |sec, opts| %>
|
||||||
|
<%= sec %> = {
|
||||||
|
<% opts.each do |key, value| %>
|
||||||
|
'<%= key %>': '<%= value %>',
|
||||||
|
<% end %>
|
||||||
|
}
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue