Skip to content
Snippets Groups Projects
Unverified Commit e1fd8d5e authored by earsdown's avatar earsdown Committed by GitHub
Browse files

Fixes postmap when ensure=absent (#202)

Fixes an issue where if a postfix map $ensure is 'absent' the postmap exec resource causes puppet runs to fail.
parent f3a280ab
No related branches found
No related tags found
No related merge requests found
...@@ -80,8 +80,13 @@ define postfix::map ( ...@@ -80,8 +80,13 @@ define postfix::map (
} }
} }
$generate_cmd = $ensure ? {
'absent' => "rm ${path}.db",
'present' => "postmap ${path}",
}
exec {"generate ${name}.db": exec {"generate ${name}.db":
command => "postmap ${path}", command => $generate_cmd,
path => $::path, path => $::path,
#creates => "${name}.db", # this prevents postmap from being run ! #creates => "${name}.db", # this prevents postmap from being run !
refreshonly => true, refreshonly => true,
......
...@@ -110,7 +110,7 @@ describe 'postfix::map' do ...@@ -110,7 +110,7 @@ describe 'postfix::map' do
it { is_expected.to contain_file('postfix map foo').with_ensure('absent') } it { is_expected.to contain_file('postfix map foo').with_ensure('absent') }
it { is_expected.to contain_file('postfix map foo').without_notify } it { is_expected.to contain_file('postfix map foo').without_notify }
it { is_expected.to contain_file('postfix map foo.db').with_ensure('absent') } it { is_expected.to contain_file('postfix map foo.db').with_ensure('absent') }
it { is_expected.to contain_exec('generate foo.db') } it { is_expected.to contain_exec('generate foo.db').with(:command => 'rm /etc/postfix/foo.db') }
end end
context 'when using pcre type' do context 'when using pcre type' do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment