Remove vhost and mailhost vhost_autogen.conf

Don't generate it anymore, and remove any existing file from
people's systems
This commit is contained in:
Matthew Haughton 2013-11-30 19:56:38 -05:00
parent d849c31c35
commit eb31df40d6
6 changed files with 11 additions and 65 deletions

View file

@ -49,7 +49,6 @@ class nginx::config(
}
if $confd_purge == true {
File["${nginx::params::nx_conf_dir}/conf.d"] {
ignore => 'vhost_autogen.conf',
purge => true,
recurse => true,
}
@ -60,12 +59,19 @@ class nginx::config(
}
if $confd_purge == true {
File["${nginx::params::nx_conf_dir}/conf.mail.d"] {
ignore => 'vhost_autogen.conf',
purge => true,
recurse => true,
}
}
file { "${nginx::params::nx_conf_dir}/conf.d/vhost_autogen.conf":
ensure => absent,
}
file { "${nginx::params::nx_conf_dir}/conf.mail.d/vhost_autogen.conf":
ensure => absent,
}
file {$nginx::config::nx_run_dir:
ensure => directory,
}
@ -102,15 +108,4 @@ class nginx::config(
content => template('nginx/conf.d/proxy.conf.erb'),
}
file { "${nginx::config::nx_temp_dir}/nginx.d":
ensure => directory,
purge => true,
recurse => true,
}
file { "${nginx::config::nx_temp_dir}/nginx.mail.d":
ensure => directory,
purge => true,
recurse => true,
}
}

View file

@ -14,7 +14,6 @@
#
# This class file is not called directly
class nginx::params {
$nx_temp_dir = '/tmp'
$nx_run_dir = '/var/nginx'
$nx_conf_dir = '/etc/nginx'

View file

@ -17,24 +17,11 @@ class nginx::service(
$configtest_enable = $nginx::params::nx_configtest_enable,
$service_restart = $nginx::params::nx_service_restart
) {
exec { 'rebuild-nginx-vhosts':
command => "/bin/cat ${nginx::params::nx_temp_dir}/nginx.d/* > ${nginx::params::nx_conf_dir}/conf.d/vhost_autogen.conf",
refreshonly => true,
unless => "/usr/bin/test ! -f ${nginx::params::nx_temp_dir}/nginx.d/*",
subscribe => File["${nginx::params::nx_temp_dir}/nginx.d"],
}
exec { 'rebuild-nginx-mailhosts':
command => "/bin/cat ${nginx::params::nx_temp_dir}/nginx.mail.d/* > ${nginx::params::nx_conf_dir}/conf.mail.d/vhost_autogen.conf",
refreshonly => true,
unless => "/usr/bin/test ! -f ${nginx::params::nx_temp_dir}/nginx.mail.d/*",
subscribe => File["${nginx::params::nx_temp_dir}/nginx.mail.d"],
}
service { 'nginx':
ensure => running,
enable => true,
hasstatus => true,
hasrestart => true,
subscribe => Exec['rebuild-nginx-vhosts', 'rebuild-nginx-mailhosts'],
}
if $configtest_enable == true {
Service['nginx'] {

View file

@ -47,6 +47,8 @@ describe 'nginx::config' do
:group => 'root',
:mode => '0644'
)}
it { should contain_file("/etc/nginx/conf.d/vhost_autogen.conf").with_ensure('absent') }
it { should contain_file("/etc/nginx/conf.mail.d/vhost_autogen.conf").with_ensure('absent') }
it { should contain_file("/var/nginx").with(
:ensure => 'directory',
:owner => 'root',
@ -76,22 +78,6 @@ describe 'nginx::config' do
:group => 'root',
:mode => '0644'
)}
it { should contain_file("/tmp/nginx.d").with(
:ensure => 'directory',
:purge => true,
:recurse => true,
:owner => 'root',
:group => 'root',
:mode => '0644'
)}
it { should contain_file("/tmp/nginx.mail.d").with(
:ensure => 'directory',
:purge => true,
:recurse => true,
:owner => 'root',
:group => 'root',
:mode => '0644'
)}
end
end
end
@ -278,7 +264,6 @@ describe 'nginx::config' do
context "when confd_purge true" do
let(:params) {{:confd_purge => true}}
it { should contain_file('/etc/nginx/conf.d').with(
:ignore => 'vhost_autogen.conf',
:purge => true,
:recurse => true
)}

View file

@ -15,26 +15,11 @@ describe 'nginx::service' do
context "using default parameters" do
it { should contain_exec('rebuild-nginx-vhosts').with(
:command => "/bin/cat /tmp/nginx.d/* > /etc/nginx/conf.d/vhost_autogen.conf",
:refreshonly => true,
:unless => "/usr/bin/test ! -f /tmp/nginx.d/*",
:subscribe => "File[/tmp/nginx.d]"
)}
it { should contain_exec('rebuild-nginx-mailhosts').with(
:command => "/bin/cat /tmp/nginx.mail.d/* > /etc/nginx/conf.mail.d/vhost_autogen.conf",
:refreshonly => true,
:unless => "/usr/bin/test ! -f /tmp/nginx.mail.d/*",
:subscribe => "File[/tmp/nginx.mail.d]"
)}
it { should contain_service('nginx').with(
:ensure => 'running',
:enable => true,
:hasstatus => true,
:hasrestart => true,
:subscribe => ['Exec[rebuild-nginx-vhosts]','Exec[rebuild-nginx-mailhosts]']
:hasrestart => true
)}
it { should contain_service('nginx').without_restart }

View file

@ -44,11 +44,6 @@ describe "nginx::resource::vhost define:" do
end
end
describe file('/etc/nginx/conf.d/vhost_autogen.conf') do
it { should be_file }
it { should contain "www.puppetlabs.com" }
end
context 'should run successfully with ssl' do
it 'should configure a nginx SSL vhost' do