diff --git a/recipes/apache2-server.rb b/recipes/apache2-server.rb index f57503a..1439f4a 100644 --- a/recipes/apache2-server.rb +++ b/recipes/apache2-server.rb @@ -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' diff --git a/spec/apache2-server_spec.rb b/spec/apache2-server_spec.rb index ee0bb4c..c6b0acd 100644 --- a/spec/apache2-server_spec.rb +++ b/spec/apache2-server_spec.rb @@ -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