From 80e0ca380e92fe435622dbd35d1a5baedb6c3f92 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Tue, 17 Jan 2017 15:18:30 -0200 Subject: Ensure the directory exists before creating the file with @aarni --- puppet/modules/site_apache/manifests/common/autorestart.pp | 12 ++++++++++-- puppet/modules/site_apache/spec/classes/autorestart.rb | 7 ------- puppet/modules/site_apache/spec/classes/autorestart_spec.rb | 7 +++++++ 3 files changed, 17 insertions(+), 9 deletions(-) delete mode 100644 puppet/modules/site_apache/spec/classes/autorestart.rb create mode 100644 puppet/modules/site_apache/spec/classes/autorestart_spec.rb diff --git a/puppet/modules/site_apache/manifests/common/autorestart.pp b/puppet/modules/site_apache/manifests/common/autorestart.pp index f8213439..0273f272 100644 --- a/puppet/modules/site_apache/manifests/common/autorestart.pp +++ b/puppet/modules/site_apache/manifests/common/autorestart.pp @@ -3,8 +3,16 @@ # class site_apache::common::autorestart { - ::systemd::unit_file { '/etc/systemd/system/apache2.service.d/autorestart.conf': + file { '/etc/systemd/system/apache2.service.d': + ensure => directory, + mode => '0755', + } + + ::systemd::unit_file { 'apache2.service.d/autorestart.conf': source => 'puppet:///modules/site_apache/autorestart.conf', - require => Service['apache'], + require => [ + File['/etc/systemd/system/apache2.service.d'], + Service['apache'], + ] } } diff --git a/puppet/modules/site_apache/spec/classes/autorestart.rb b/puppet/modules/site_apache/spec/classes/autorestart.rb deleted file mode 100644 index afa02ec9..00000000 --- a/puppet/modules/site_apache/spec/classes/autorestart.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'spec_helper' - -describe 'site_apache::common::autorestart' do - it "should include apache autorestart" do - should contain_file('/etc/systemd/system/apache2.service.d/autorestart.conf').with_source('puppet:///modules/site_apache/autorestart.conf') - end -end diff --git a/puppet/modules/site_apache/spec/classes/autorestart_spec.rb b/puppet/modules/site_apache/spec/classes/autorestart_spec.rb new file mode 100644 index 00000000..ad9c9f2e --- /dev/null +++ b/puppet/modules/site_apache/spec/classes/autorestart_spec.rb @@ -0,0 +1,7 @@ +require 'spec_helper' + +describe 'site_apache::common::autorestart' do + it "should include apache autorestart" do + should contain_file('apache2.service.d/autorestart.conf').with_source('puppet:///modules/site_apache/autorestart.conf') + end +end -- cgit v1.2.3