diff --git a/manifests/custom_config.pp b/manifests/custom_config.pp index ceb1fd077..7ce755b35 100644 --- a/manifests/custom_config.pp +++ b/manifests/custom_config.pp @@ -49,12 +49,13 @@ } if $ensure == 'present' and $verify_config { - exec { "service notify for ${name}": + exec { "syntax verification for ${name}": command => $verify_command, subscribe => File["apache_${name}"], refreshonly => true, notify => Class['Apache::Service'], before => Exec["remove ${name} if invalid"], + require => Anchor['::apache::modules_set_up'] } exec { "remove ${name} if invalid": diff --git a/manifests/init.pp b/manifests/init.pp index 873b42ef4..7baa65713 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -381,4 +381,8 @@ manage_docroot => $default_ssl_vhost, } } + + # This anchor can be used as a reference point for things that need to happen *after* + # all modules have been put in place. + anchor { '::apache::modules_set_up': } } diff --git a/manifests/mod.pp b/manifests/mod.pp index 920114a7c..abdbfcbed 100644 --- a/manifests/mod.pp +++ b/manifests/mod.pp @@ -162,4 +162,6 @@ } } } + + Apache::Mod[$name] -> Anchor['::apache::modules_set_up'] } diff --git a/spec/defines/custom_config_spec.rb b/spec/defines/custom_config_spec.rb index a5efd15a2..7d566b071 100644 --- a/spec/defines/custom_config_spec.rb +++ b/spec/defines/custom_config_spec.rb @@ -26,7 +26,7 @@ 'content' => '# Test', } end - it { is_expected.to contain_exec("service notify for rspec").with({ + it { is_expected.to contain_exec("syntax verification for rspec").with({ 'refreshonly' => 'true', 'subscribe' => 'File[apache_rspec]', 'command' => '/usr/sbin/apachectl -t', @@ -56,7 +56,7 @@ 'verify_command' => '/bin/true', } end - it { is_expected.to contain_exec("service notify for rspec").with({ + it { is_expected.to contain_exec("syntax verification for rspec").with({ 'command' => '/bin/true', }) } @@ -80,7 +80,7 @@ 'verify_config' => false, } end - it { is_expected.to_not contain_exec('service notify for rspec') } + it { is_expected.to_not contain_exec('syntax verification for rspec') } it { is_expected.to_not contain_exec('remove rspec if invalid') } it { is_expected.to contain_file('apache_rspec').with({ 'notify' => 'Class[Apache::Service]' @@ -93,7 +93,7 @@ 'ensure' => 'absent' } end - it { is_expected.to_not contain_exec('service notify for rspec') } + it { is_expected.to_not contain_exec('syntax verification for rspec') } it { is_expected.to_not contain_exec('remove rspec if invalid') } it { is_expected.to contain_file('apache_rspec').with({ 'ensure' => 'absent',