Unverified Commit e1fd8d5e authored by earsdown's avatar earsdown Committed by GitHub

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
......@@ -80,8 +80,13 @@ define postfix::map (
}
}
$generate_cmd = $ensure ? {
'absent' => "rm ${path}.db",
'present' => "postmap ${path}",
}
exec {"generate ${name}.db":
command => "postmap ${path}",
command => $generate_cmd,
path => $::path,
#creates => "${name}.db", # this prevents postmap from being run !
refreshonly => true,
......
......@@ -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').without_notify }
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
context 'when using pcre type' do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment