Merge "Use anchor to require necessary packages"

This commit is contained in:
Zuul 2020-05-04 00:58:58 +00:00 committed by Gerrit Code Review
commit 4b2d0bad4c
4 changed files with 11 additions and 11 deletions

View File

@ -46,8 +46,8 @@ Puppet::Type.newtype(:octavia_config) do
defaultto('<SERVICE DEFAULT>')
end
autorequire(:package) do
'octavia'
autorequire(:anchor) do
['octavia::install::end']
end
end

View File

@ -46,8 +46,8 @@ Puppet::Type.newtype(:octavia_ovn_provider_config) do
defaultto('<SERVICE DEFAULT>')
end
autorequire(:package) do
'octavia'
autorequire(:anchor) do
['octavia::install::end']
end
end

View File

@ -50,14 +50,14 @@ describe 'Puppet::Type.type(:octavia_config)' do
}.to raise_error(Puppet::Error, /Invalid value/)
end
it 'should autorequire the package that install the file' do
it 'should autorequire the anchor that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'octavia')
catalog.add_resource package, @octavia_config
anchor = Puppet::Type.type(:anchor).new(:name => 'octavia::install::end')
catalog.add_resource anchor, @octavia_config
dependency = @octavia_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@octavia_config)
expect(dependency[0].source).to eq(package)
expect(dependency[0].source).to eq(anchor)
end

View File

@ -52,12 +52,12 @@ describe 'Puppet::Type.type(:octavia_ovn_provider_config)' do
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'octavia')
catalog.add_resource package, @octavia_ovn_provider_config
anchor = Puppet::Type.type(:anchor).new(:name => 'octavia::install::end')
catalog.add_resource anchor, @octavia_ovn_provider_config
dependency = @octavia_ovn_provider_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@octavia_ovn_provider_config)
expect(dependency[0].source).to eq(package)
expect(dependency[0].source).to eq(anchor)
end