Rely on autorequire for config resource ordering
Currently we specify the ordering of config resources wherever it is necessary based on the presence of the file it will write to, or the presence of the package in charge of providing the file it will write to. Those kind of ordering can be specified directly at the resource level using the autorequire mechanism. With this patch, any config resource will make sure the package in charge of providing the file will be installed first. Change-Id: I8f959e4ebbce2545843a901345a2ac3daf4259a1
This commit is contained in:
parent
35efc0e795
commit
712bfd942c
|
@ -40,4 +40,8 @@ Puppet::Type.newtype(:designate_api_paste_ini) do
|
|||
defaultto false
|
||||
end
|
||||
|
||||
autorequire(:package) do
|
||||
'designate-common'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -40,4 +40,9 @@ Puppet::Type.newtype(:designate_config) do
|
|||
|
||||
defaultto false
|
||||
end
|
||||
|
||||
autorequire(:package) do
|
||||
'designate-common'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -49,4 +49,15 @@ describe 'Puppet::Type.type(:designate_config)' do
|
|||
@designate_config[:ensure] = :latest
|
||||
}.to raise_error(Puppet::Error, /Invalid value/)
|
||||
end
|
||||
|
||||
it 'should autorequire the package that install the file' do
|
||||
catalog = Puppet::Resource::Catalog.new
|
||||
package = Puppet::Type.type(:package).new(:name => 'designate-common')
|
||||
catalog.add_resource package, @designate_config
|
||||
dependency = @designate_config.autorequire
|
||||
expect(dependency.size).to eq(1)
|
||||
expect(dependency[0].target).to eq(@designate_config)
|
||||
expect(dependency[0].source).to eq(package)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue