Use anchor to require necessary packages
... so that correct packages are required without re-defining them in resource implementations. Change-Id: I274e2aa28648f1c875d1f43b26a2afc1e65ee3bc
This commit is contained in:
parent
b1ea700ba8
commit
2e1a3d0647
@ -45,8 +45,8 @@ Puppet::Type.newtype(:ironic_api_paste_ini) do
|
||||
defaultto('<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
autorequire(:package) do
|
||||
'ironic'
|
||||
autorequire(:anchor) do
|
||||
['ironic::install::end']
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -48,8 +48,8 @@ Puppet::Type.newtype(:ironic_config) do
|
||||
|
||||
newparam(:transform_to)
|
||||
|
||||
autorequire(:package) do
|
||||
'ironic-common'
|
||||
autorequire(:anchor) do
|
||||
['ironic::install::end']
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -46,8 +46,8 @@ Puppet::Type.newtype(:ironic_inspector_config) do
|
||||
defaultto('<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
autorequire(:package) do
|
||||
'ironic-inspector'
|
||||
autorequire(:anchor) do
|
||||
['ironic::install::end']
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,21 +1,11 @@
|
||||
require 'spec_helper'
|
||||
# this hack is required for now to ensure that the path is set up correctly
|
||||
# to retrieve the parent provider
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
require 'puppet'
|
||||
require 'puppet/type/ironic_api_paste_ini'
|
||||
|
||||
describe 'Puppet::Type.type(:ironic_api_paste_ini)' do
|
||||
before :each do
|
||||
@ironic_api_paste_ini = Puppet::Type.type(:ironic_api_paste_ini).new(:name => 'DEFAULT/foo', :value => 'bar')
|
||||
end
|
||||
|
||||
it 'should accept a valid value' do
|
||||
@ironic_api_paste_ini[:value] = 'bar'
|
||||
expect(@ironic_api_paste_ini[:value]).to eq('bar')
|
||||
@ -23,12 +13,12 @@ describe 'Puppet::Type.type(:ironic_api_paste_ini)' do
|
||||
|
||||
it 'should autorequire the package that install the file' do
|
||||
catalog = Puppet::Resource::Catalog.new
|
||||
package = Puppet::Type.type(:package).new(:name => 'ironic')
|
||||
catalog.add_resource package, @ironic_api_paste_ini
|
||||
anchor = Puppet::Type.type(:anchor).new(:name => 'ironic::install::end')
|
||||
catalog.add_resource anchor, @ironic_api_paste_ini
|
||||
dependency = @ironic_api_paste_ini.autorequire
|
||||
expect(dependency.size).to eq(1)
|
||||
expect(dependency[0].target).to eq(@ironic_api_paste_ini)
|
||||
expect(dependency[0].source).to eq(package)
|
||||
expect(dependency[0].source).to eq(anchor)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -53,12 +53,12 @@ describe 'Puppet::Type.type(:ironic_config)' do
|
||||
|
||||
it 'should autorequire the package that install the file' do
|
||||
catalog = Puppet::Resource::Catalog.new
|
||||
package = Puppet::Type.type(:package).new(:name => 'ironic-common')
|
||||
catalog.add_resource package, @ironic_config
|
||||
anchor = Puppet::Type.type(:anchor).new(:name => 'ironic::install::end')
|
||||
catalog.add_resource anchor, @ironic_config
|
||||
dependency = @ironic_config.autorequire
|
||||
expect(dependency.size).to eq(1)
|
||||
expect(dependency[0].target).to eq(@ironic_config)
|
||||
expect(dependency[0].source).to eq(package)
|
||||
expect(dependency[0].source).to eq(anchor)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -8,12 +8,12 @@ describe 'Puppet::Type.type(:ironic_inspector_config)' do
|
||||
|
||||
it 'should autorequire the package that install the file' do
|
||||
catalog = Puppet::Resource::Catalog.new
|
||||
package = Puppet::Type.type(:package).new(:name => 'ironic-inspector')
|
||||
catalog.add_resource package, @ironic_inspector_config
|
||||
anchor = Puppet::Type.type(:anchor).new(:name => 'ironic::install::end')
|
||||
catalog.add_resource anchor, @ironic_inspector_config
|
||||
dependency = @ironic_inspector_config.autorequire
|
||||
expect(dependency.size).to eq(1)
|
||||
expect(dependency[0].target).to eq(@ironic_inspector_config)
|
||||
expect(dependency[0].source).to eq(package)
|
||||
expect(dependency[0].source).to eq(anchor)
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user