From 576fe04b85b3eacc23da356bf46f5b22169d7419 Mon Sep 17 00:00:00 2001 From: Glauco Oliveira Date: Wed, 4 Nov 2015 19:14:57 -0200 Subject: [PATCH] Fix broken acceptance tests While applying this module downstream we noticed that its acceptance tests were broken. During the process of fixing them we noticed that the reason for this were the changes made in the manifest 'openstack_health::frontend'. Apparently a new manifest was created to take care of installing the frontend, 'openstack_health::vhost'. The first step in order to fix this was adapting the tests to use this new manifest instead of the former. While doing so we noticed that the apache vhost template file was not being generated correctly. That happened because it was binding agains 'openstack_health::frontend', which now did not have the parameters necessary. So, in order to make the whole acceptance test suite work, it was necessary updating the vhost template file as well. Change-Id: I79edb3b05ca25b484a62d6a414592e662b42d85e Co-Authored-By: Danilo Ramalho --- manifests/vhost.pp | 13 +++++++------ spec/acceptance/fixtures/frontend.pp | 5 ++--- templates/openstack-health-frontend.vhost.erb | 14 +++++++------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/manifests/vhost.pp b/manifests/vhost.pp index 1e131cc..ddb45ee 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -22,11 +22,12 @@ class openstack_health::vhost( $frontend_dir = "${openstack_health::source_dir}/build" httpd::vhost { "${vhost_name}-frontend": - docroot => 'MEANINGLESS ARGUMENT', - port => $vhost_port, - priority => '100', - ssl => false, - template => 'openstack_health/openstack-health-frontend.vhost.erb', - require => Exec['build-static-files'], + docroot => 'MEANINGLESS ARGUMENT', + vhost_name => $vhost_name, + port => $vhost_port, + priority => '100', + ssl => false, + template => 'openstack_health/openstack-health-frontend.vhost.erb', + require => Exec['build-static-files'], } } diff --git a/spec/acceptance/fixtures/frontend.pp b/spec/acceptance/fixtures/frontend.pp index 687b4c2..5f91cb8 100644 --- a/spec/acceptance/fixtures/frontend.pp +++ b/spec/acceptance/fixtures/frontend.pp @@ -4,9 +4,8 @@ class { '::openstack_health': source_dir => $source_dir, } -class { '::openstack_health::frontend': - source_dir => '/opt/openstack-health', - serveradmin => 'webmaster@localhost', +class { '::openstack_health::vhost': + serveradmin => "webmaster@${::fqdn}", vhost_name => 'localhost', vhost_port => 80, api_endpoint => 'http://localhost:5000', diff --git a/templates/openstack-health-frontend.vhost.erb b/templates/openstack-health-frontend.vhost.erb index 6fdd9a0..d14f8fa 100644 --- a/templates/openstack-health-frontend.vhost.erb +++ b/templates/openstack-health-frontend.vhost.erb @@ -1,20 +1,20 @@ -<% unless [443, 80].include?(scope.lookupvar("openstack_health::frontend::vhost_port").to_i) %> -Listen <%= scope.lookupvar("openstack_health::frontend::vhost_port") %> +<% unless [443, 80].include?(@vhost_port.to_i) %> +Listen <%= @vhost_port %> <% end %> -> - ServerName <%= scope.lookupvar("openstack_health::frontend::vhost_name") %> - ServerAdmin <%= scope.lookupvar("openstack_health::frontend::serveradmin") %> +> + ServerName <%= @vhost_name %> + ServerAdmin <%= @serveradmin %> LogLevel info CustomLog ${APACHE_LOG_DIR}/openstack-health-frontend-access.log combined ErrorLog ${APACHE_LOG_DIR}/openstack-health-frontend-error.log - > + > Order allow,deny Allow from all Require all granted - DocumentRoot <%= scope.lookupvar("openstack_health::frontend::frontend_dir") %> + DocumentRoot <%= @frontend_dir %> DirectoryIndex index.html