Skip to content
Snippets Groups Projects
Commit c8253b6e authored by treydock's avatar treydock Committed by Raphaël Pinson
Browse files

Do not generate postmap when postfix::map ensure is absent (#178)

parent 8bc88588
Branches
Tags
No related merge requests found
...@@ -47,7 +47,11 @@ define postfix::map ( ...@@ -47,7 +47,11 @@ define postfix::map (
if $type =~ /^(cidr|pcre)$/ { if $type =~ /^(cidr|pcre)$/ {
$manage_notify = Service['postfix'] $manage_notify = Service['postfix']
} else { } else {
if $ensure == 'present' {
$manage_notify = Exec["generate ${name}.db"] $manage_notify = Exec["generate ${name}.db"]
} else {
$manage_notify = undef
}
} }
file { "postfix map ${name}": file { "postfix map ${name}":
......
...@@ -91,6 +91,7 @@ describe 'postfix::map' do ...@@ -91,6 +91,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.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') }
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment