Commit 17d9d6ee authored by Raphaël Pinson's avatar Raphaël Pinson Committed by GitHub
Browse files

Fix resource dependencies (#185)

* Fix resource dependencies

Dependencies must be set only if the resources exist in the catalog.
For some weird reason, this worked in Puppet 4 (and shouldn't have).

* Fix AbsolutePath test for Puppet 5
parent 93ec96b9
...@@ -76,10 +76,14 @@ define postfix::transport ( ...@@ -76,10 +76,14 @@ define postfix::transport (
lens => 'Postfix_Transport.lns', lens => 'Postfix_Transport.lns',
incl => $file, incl => $file,
changes => $changes, changes => $changes,
require => [ require => Augeas::Lens['postfix_transport'],
Package['postfix'], }
Augeas::Lens['postfix_transport'],
], if defined(Package['postfix']) {
notify => Postfix::Hash['/etc/postfix/transport'], Package['postfix'] -> Postfix::Transport[$title]
}
if defined(Postfix::Hash['/etc/postfix/transport']) {
Postfix::Transport[$title] ~> Postfix::Hash['/etc/postfix/transport']
} }
} }
...@@ -63,10 +63,14 @@ define postfix::virtual ( ...@@ -63,10 +63,14 @@ define postfix::virtual (
incl => $file, incl => $file,
lens => 'Postfix_Virtual.lns', lens => 'Postfix_Virtual.lns',
changes => $changes, changes => $changes,
require => [ require => Augeas::Lens['postfix_virtual'],
Package['postfix'], }
Augeas::Lens['postfix_virtual'],
], if defined(Package['postfix']) {
notify => Postfix::Hash[$file], Package['postfix'] -> Postfix::Virtual[$title]
}
if defined(Postfix::Hash[$file]) {
Postfix::Virtual[$title] ~> Postfix::Hash[$file]
} }
} }
...@@ -40,7 +40,7 @@ describe 'postfix::hash' do ...@@ -40,7 +40,7 @@ describe 'postfix::hash' do
it 'should fail' do it 'should fail' do
expect { expect {
is_expected.to contain_file('/tmp/foo') is_expected.to contain_file('/tmp/foo')
}.to raise_error(Puppet::Error, /got 'foo'/) }.to raise_error(Puppet::Error, /, got /)
end end
end end
......
...@@ -63,7 +63,7 @@ describe 'postfix::transport' do ...@@ -63,7 +63,7 @@ describe 'postfix::transport' do
it 'should fail' do it 'should fail' do
expect { expect {
is_expected.to contain_augeas('Postfix transport - foo') is_expected.to contain_augeas('Postfix transport - foo')
}.to raise_error(Puppet::Error, /got 'baz'/) }.to raise_error(Puppet::Error, /, got /)
end end
end end
......
...@@ -58,7 +58,7 @@ describe 'postfix::virtual' do ...@@ -58,7 +58,7 @@ describe 'postfix::virtual' do
it 'should fail' do it 'should fail' do
expect { expect {
is_expected.to contain_augeas('Postfix virtual - foo') is_expected.to contain_augeas('Postfix virtual - foo')
}.to raise_error(Puppet::Error, /got 'baz'/) }.to raise_error(Puppet::Error, /, got /)
end end
end end
......
Supports Markdown
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