use Array for apache2 listen attributes

* the apache2 cookbook got patched recently and now uses an array of
  "ipaddress:port" to define where apache2 should listen

Change-Id: I7304932c19398c2bd245bbb7cbad6df4f487047e
This commit is contained in:
Jan Klare 2016-03-02 14:10:51 +01:00 committed by Jens Rosenboom
parent 75e51698ad
commit 14ce391e1b
2 changed files with 8 additions and 9 deletions

View File

@ -43,16 +43,16 @@ end
http_bind = node['openstack']['bind_service']['dashboard_http']
https_bind = node['openstack']['bind_service']['dashboard_https']
# This allow the apache2/templates/default/ports.conf.erb to setup the correct listeners.
http_listen = { http_bind.host => [http_bind.port.to_s] }
# This allows the apache2/templates/default/ports.conf.erb to setup the correct listeners.
# Need to convert from Chef::Node::ImmutableArray in order to be able to modify
apache2_listen = Array(node['apache']['listen'])
apache2_listen += ["#{http_bind.host}:#{http_bind.port}"]
if node['openstack']['dashboard']['use_ssl']
apache_listen = Chef::Mixin::DeepMerge.merge(http_listen, https_bind.host => [https_bind.port.to_s])
else
apache_listen = http_listen
apache2_listen += ["#{https_bind.host}:#{https_bind.port}"]
end
node.normal['apache']['listen'] =
Chef::Mixin::DeepMerge.merge(node['apache']['listen'], apache_listen)
node.normal['apache']['listen'] = apache2_listen.uniq
include_recipe 'apache2'
include_recipe 'apache2::mod_headers'

View File

@ -55,8 +55,7 @@ describe 'openstack-dashboard::apache2-server' do
end
it 'set apache addresses and ports' do
expect(chef_run.node['apache']['listen']).to eq '*' => %w(80), '0.0.0.0' => %w(80 443)
# expect(chef_run.node['apache']['listen_ports']).to eq [80, 443]
expect(chef_run.node['apache']['listen']).to eq %w(*:80 0.0.0.0:80 0.0.0.0:443)
end
it 'includes apache packages' do