Merge "Use anchor to require necessary packages/services"
This commit is contained in:
commit
6573b21529
@ -46,8 +46,8 @@ Puppet::Type.newtype(:mistral_config) do
|
||||
defaultto('<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
autorequire(:package) do
|
||||
'mistral-common'
|
||||
autorequire(:anchor) do
|
||||
['mistral::install::end']
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -57,7 +57,7 @@ Puppet::Type.newtype(:mistral_workflow) do
|
||||
end
|
||||
|
||||
# Require the Mistral API service to be running
|
||||
autorequire(:service) do
|
||||
['mistral-api']
|
||||
autorequire(:anchor) do
|
||||
['mistral::service::end']
|
||||
end
|
||||
end
|
||||
|
@ -49,4 +49,15 @@ describe 'Puppet::Type.type(:mistral_config)' do
|
||||
@mistral_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
|
||||
anchor = Puppet::Type.type(:anchor).new(:name => 'mistral::install::end')
|
||||
catalog.add_resource anchor, @mistral_config
|
||||
dependency = @mistral_config.autorequire
|
||||
expect(dependency.size).to eq(1)
|
||||
expect(dependency[0].target).to eq(@mistral_config)
|
||||
expect(dependency[0].source).to eq(anchor)
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user