Fix httpd ordering, add rspec test

The ordering is wrong here, as the docroot tries to depend on the 503
file that inside the docroot.  I missed this because I was on a live
system where the file existed.  Move to a more standard "www_base"
like in other modules.

Add a deployment test to find things like this.

Change-Id: I9b048836fa9942f021f81f7a744bcc9af96a10be
This commit is contained in:
Ian Wienand 2017-12-15 13:25:04 +11:00
parent ef1008424a
commit 46bfc54912
3 changed files with 42 additions and 12 deletions

View File

@ -5,7 +5,7 @@ class hound (
$config_json = 'hound/config.json',
$datadir = '/home/hound/data',
$manage_config = true,
$docroot = '/var/www/hound',
$www_base = '/var/www/',
$serveradmin = "webmaster@${::fqdn}",
$serveraliases = undef,
$vhost_name = $::fqdn,
@ -13,6 +13,23 @@ class hound (
$git_source_uri = 'git://github.com/etsy/Hound.git',
) {
$docroot = "${www_base}/hound"
file { $www_base:
ensure => directory,
owner => root,
group => root,
}
file { $docroot:
ensure => directory,
owner => root,
group => root,
require => [
File[$www_base],
]
}
package { 'golang':
ensure => present,
}
@ -98,17 +115,17 @@ class hound (
include ::httpd
httpd_mod { 'rewrite':
httpd::mod { 'rewrite':
ensure => present,
before => Service['hound'],
}
httpd_mod { 'proxy':
httpd::mod { 'proxy':
ensure => present,
before => Service['hound'],
}
httpd_mod { 'proxy_http':
httpd::mod { 'proxy_http':
ensure => present,
before => Service['hound'],
}
@ -118,14 +135,7 @@ class hound (
docroot => $docroot,
priority => '50',
template => 'hound/hound.vhost.erb',
require => File["${docroot}/503.html"],
}
file { $docroot:
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755'
require => File[$docroot],
}
file { "${docroot}/503.html":
@ -134,6 +144,7 @@ class hound (
group => 'root',
mode => '0644',
content => template('hound/503.html.erb'),
require => File[$docroot],
}
file { '/var/log/hound.log':

View File

@ -0,0 +1 @@
class { '::hound': }

View File

@ -0,0 +1,18 @@
require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
describe 'puppet-hound:: manifest', :if => ['debian', 'ubuntu'].include?(os[:family]) do
def pp_path
base_path = File.dirname(__FILE__)
File.join(base_path, 'fixtures')
end
def init_puppet_module
module_path = File.join(pp_path, 'hound.pp')
File.read(module_path)
end
it 'should work with no errors' do
apply_manifest(init_puppet_module, catch_failures: true)
end
end