Use anchor to require necessary packages
... so that correct packages are required without re-defining them in resource implementations. Change-Id: Ib1348b6a65dbcd985212ddda7c28c4e4e88f675f
This commit is contained in:
parent
6a2a4da43b
commit
8c66365065
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user