From 8262fa90cc40b6e858d87cd1165c01b73293d0a9 Mon Sep 17 00:00:00 2001 From: Quien Sabe Date: Thu, 16 Jul 2020 17:21:38 -0400 Subject: [PATCH] Actualy use the ensure parameter for mailhost resource to provide absent support. Corretly test that concat resource parameter ensure is absent. --- manifests/resource/mailhost.pp | 1 + spec/defines/resource_mailhost_spec.rb | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/manifests/resource/mailhost.pp b/manifests/resource/mailhost.pp index f8607da85..34bf54653 100644 --- a/manifests/resource/mailhost.pp +++ b/manifests/resource/mailhost.pp @@ -152,6 +152,7 @@ } concat { $config_file: + ensure => $ensure, owner => 'root', group => $root_group, mode => $nginx::global_mode, diff --git a/spec/defines/resource_mailhost_spec.rb b/spec/defines/resource_mailhost_spec.rb index 1c03b0709..f6812e502 100644 --- a/spec/defines/resource_mailhost_spec.rb +++ b/spec/defines/resource_mailhost_spec.rb @@ -30,6 +30,13 @@ it { is_expected.not_to contain_concat__fragment("#{title}-ssl") } end + describe 'absent assumption' do + let(:params) { default_params.merge('ensure'.to_sym => 'absent') } + + it { is_expected.to contain_class('nginx') } + it { is_expected.to contain_concat("/etc/nginx/conf.mail.d/#{title}.conf").with('ensure' => 'absent') } + end + describe 'mailhost template content' do [ {