Include ServerAlias in dashboard vhost if set
There are use cases where having ServerAlias in the vhost is preferred. This includes that option but excludes by default. It's set using an array so you can set multiple server aliases. I also added the virtualhost port configurator test for dashboard-http-bind on port 80 to ensure it works on both ports. Change-Id: I621cb2a519e92d04d60fd75e727b59250bd72e30
This commit is contained in:
parent
796945e658
commit
5fad88d1c0
|
@ -51,6 +51,7 @@ default['openstack']['dashboard']['keystone_default_role'] = '_member_'
|
||||||
default['openstack']['dashboard']['keystone_service_chef_role'] = 'keystone'
|
default['openstack']['dashboard']['keystone_service_chef_role'] = 'keystone'
|
||||||
|
|
||||||
default['openstack']['dashboard']['server_hostname'] = nil
|
default['openstack']['dashboard']['server_hostname'] = nil
|
||||||
|
default['openstack']['dashboard']['server_aliases'] = []
|
||||||
default['openstack']['dashboard']['use_ssl'] = true
|
default['openstack']['dashboard']['use_ssl'] = true
|
||||||
# When using a remote certificate and key, the names of the actual installed certificate
|
# When using a remote certificate and key, the names of the actual installed certificate
|
||||||
# and key in the file system are determined by the following two attributes.
|
# and key in the file system are determined by the following two attributes.
|
||||||
|
|
|
@ -31,6 +31,20 @@ shared_examples 'virtualhost port configurator' do |port_attribute_name, port_at
|
||||||
expect(chef_run).not_to render_file(file.name).with_content(/^#{virtualhost_directive}\s*ServerName$/)
|
expect(chef_run).not_to render_file(file.name).with_content(/^#{virtualhost_directive}\s*ServerName$/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
context 'server_aliases' do
|
||||||
|
it 'sets the value if the server_aliases is present' do
|
||||||
|
node.set['openstack']['dashboard']['server_aliases'] = %w(server_aliases_value)
|
||||||
|
expect(chef_run).to render_file(file.name).with_content(/^#{virtualhost_directive}\s*ServerAlias server_aliases_value$/)
|
||||||
|
end
|
||||||
|
it 'sets the value if multiple server_aliases is present' do
|
||||||
|
node.set['openstack']['dashboard']['server_aliases'] = %w(server_aliases_value1 server_aliases_value2)
|
||||||
|
expect(chef_run).to render_file(file.name).with_content(/^#{virtualhost_directive}\s*ServerAlias server_aliases_value1 server_aliases_value2$/)
|
||||||
|
end
|
||||||
|
it 'does not set the value if the server_aliases is not present' do
|
||||||
|
node.set['openstack']['dashboard']['server_hostname'] = []
|
||||||
|
expect(chef_run).not_to render_file(file.name).with_content(/^#{virtualhost_directive}\s*ServerAlias$/)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'openstack-dashboard::apache2-server' do
|
describe 'openstack-dashboard::apache2-server' do
|
||||||
|
@ -262,6 +276,8 @@ describe 'openstack-dashboard::apache2-server' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it_should_behave_like 'virtualhost port configurator', 'dashboard-http-bind', 80
|
||||||
|
|
||||||
context 'with use_ssl enabled' do
|
context 'with use_ssl enabled' do
|
||||||
before do
|
before do
|
||||||
node.set['openstack']['dashboard']['use_ssl'] = true
|
node.set['openstack']['dashboard']['use_ssl'] = true
|
||||||
|
|
|
@ -8,6 +8,9 @@ NameVirtualHost <%= @http_bind_address %>:<%= @http_bind_port %>
|
||||||
<% if node["openstack"]["dashboard"]["server_hostname"] -%>
|
<% if node["openstack"]["dashboard"]["server_hostname"] -%>
|
||||||
ServerName <%= node["openstack"]["dashboard"]["server_hostname"] %>
|
ServerName <%= node["openstack"]["dashboard"]["server_hostname"] %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
<% unless node["openstack"]["dashboard"]["server_aliases"].empty? -%>
|
||||||
|
ServerAlias <%= node["openstack"]["dashboard"]["server_aliases"].join(" ") %>
|
||||||
|
<% end -%>
|
||||||
<% if node["openstack"]["dashboard"]["use_ssl"] %>
|
<% if node["openstack"]["dashboard"]["use_ssl"] %>
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteCond %{HTTPS} off
|
RewriteCond %{HTTPS} off
|
||||||
|
@ -27,6 +30,9 @@ NameVirtualHost <%= @https_bind_address %>:<%= @https_bind_port %>
|
||||||
<% if node["openstack"]["dashboard"]["server_hostname"] -%>
|
<% if node["openstack"]["dashboard"]["server_hostname"] -%>
|
||||||
ServerName <%= node["openstack"]["dashboard"]["server_hostname"] %>
|
ServerName <%= node["openstack"]["dashboard"]["server_hostname"] %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
<% unless node["openstack"]["dashboard"]["server_aliases"].empty? -%>
|
||||||
|
ServerAlias <%= node["openstack"]["dashboard"]["server_aliases"].join(" ") %>
|
||||||
|
<% end -%>
|
||||||
<% end %>
|
<% end %>
|
||||||
ServerAdmin <%= node["apache"]["contact"] %>
|
ServerAdmin <%= node["apache"]["contact"] %>
|
||||||
WSGIScriptAlias <%= node["openstack"]["dashboard"]["webroot"] %> <%= node["openstack"]["dashboard"]["wsgi_path"] %>
|
WSGIScriptAlias <%= node["openstack"]["dashboard"]["webroot"] %> <%= node["openstack"]["dashboard"]["wsgi_path"] %>
|
||||||
|
|
Loading…
Reference in New Issue