Use anchor to require necessary packages
... so that correct packages are required without re-defining them in resource implementations. Change-Id: Iae4374a503cf46e3c774dad36f48f25526de765e
This commit is contained in:
parent
46bf71a56b
commit
35e4cb2a7d
@ -52,8 +52,8 @@ module PuppetX
|
||||
defaultto('<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
autorequire(:package) do
|
||||
'keystone'
|
||||
autorequire(:anchor) do
|
||||
['keystone::install::end']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,16 +1,3 @@
|
||||
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/keystone_config'
|
||||
|
||||
@ -66,12 +53,12 @@ describe 'Puppet::Type.type(:keystone_config)' do
|
||||
|
||||
it 'should autorequire the package that install the file' do
|
||||
catalog = Puppet::Resource::Catalog.new
|
||||
package = Puppet::Type.type(:package).new(:name => 'keystone')
|
||||
catalog.add_resource package, @keystone_config
|
||||
anchor = Puppet::Type.type(:anchor).new(:name => 'keystone::install::end')
|
||||
catalog.add_resource anchor, @keystone_config
|
||||
dependency = @keystone_config.autorequire
|
||||
expect(dependency.size).to eq(1)
|
||||
expect(dependency[0].target).to eq(@keystone_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