Commit 08048aac authored by treydock's avatar treydock Committed by Raphaël Pinson
Browse files

Fix virtual.db and transport.db creation (#135)

May address #130
parent ba2945fe
...@@ -70,6 +70,12 @@ define postfix::hash ( ...@@ -70,6 +70,12 @@ define postfix::hash (
} }
exec {"generate ${name}.db": exec {"generate ${name}.db":
command => "postmap ${name}",
path => $::path,
creates => "${name}.db", # this prevents postmap from being run !
require => File[$name],
}
exec {"regenerate ${name}.db":
command => "postmap ${name}", command => "postmap ${name}",
path => $::path, path => $::path,
#creates => "${name}.db", # this prevents postmap from being run ! #creates => "${name}.db", # this prevents postmap from being run !
......
...@@ -69,6 +69,7 @@ describe 'postfix::hash' do ...@@ -69,6 +69,7 @@ describe 'postfix::hash' do
} }
it { is_expected.to contain_file('/tmp/foo.db').with_ensure('present') } it { is_expected.to contain_file('/tmp/foo.db').with_ensure('present') }
it { is_expected.to contain_exec('generate /tmp/foo.db') } it { is_expected.to contain_exec('generate /tmp/foo.db') }
it { is_expected.to contain_exec('regenerate /tmp/foo.db') }
end end
context 'when passing content' do context 'when passing content' do
...@@ -83,6 +84,7 @@ describe 'postfix::hash' do ...@@ -83,6 +84,7 @@ describe 'postfix::hash' do
} }
it { is_expected.to contain_file('/tmp/foo.db').with_ensure('present') } it { is_expected.to contain_file('/tmp/foo.db').with_ensure('present') }
it { is_expected.to contain_exec('generate /tmp/foo.db') } it { is_expected.to contain_exec('generate /tmp/foo.db') }
it { is_expected.to contain_exec('regenerate /tmp/foo.db') }
end end
context 'when not passing source or content' do context 'when not passing source or content' do
...@@ -92,6 +94,7 @@ describe 'postfix::hash' do ...@@ -92,6 +94,7 @@ describe 'postfix::hash' do
} }
it { is_expected.to contain_file('/tmp/foo.db').with_ensure('present') } it { is_expected.to contain_file('/tmp/foo.db').with_ensure('present') }
it { is_expected.to contain_exec('generate /tmp/foo.db') } it { is_expected.to contain_exec('generate /tmp/foo.db') }
it { is_expected.to contain_exec('regenerate /tmp/foo.db') }
end end
context 'when ensuring absence' do context 'when ensuring absence' do
...@@ -102,6 +105,7 @@ describe 'postfix::hash' do ...@@ -102,6 +105,7 @@ describe 'postfix::hash' do
it { is_expected.to contain_file('/tmp/foo').with_ensure('absent') } it { is_expected.to contain_file('/tmp/foo').with_ensure('absent') }
it { is_expected.to contain_file('/tmp/foo.db').with_ensure('absent') } it { is_expected.to contain_file('/tmp/foo.db').with_ensure('absent') }
it { is_expected.to contain_exec('generate /tmp/foo.db') } it { is_expected.to contain_exec('generate /tmp/foo.db') }
it { is_expected.to contain_exec('regenerate /tmp/foo.db') }
end end
end end
end end
......
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