Use anchor to require necessary packages
... so that correct packages are required without re-defining them in resource implementations. Change-Id: I9e1e3443659c41fbacb50639cb605686729eb2a2
This commit is contained in:
parent
431016708a
commit
26944d9e50
@ -45,7 +45,7 @@ Puppet::Type.newtype(:trove_api_paste_ini) do
|
|||||||
defaultto('<SERVICE DEFAULT>')
|
defaultto('<SERVICE DEFAULT>')
|
||||||
end
|
end
|
||||||
|
|
||||||
autorequire(:package) do
|
autorequire(:anchor) do
|
||||||
'trove-api'
|
['trove::install::end']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -46,7 +46,7 @@ Puppet::Type.newtype(:trove_conductor_config) do
|
|||||||
defaultto('<SERVICE DEFAULT>')
|
defaultto('<SERVICE DEFAULT>')
|
||||||
end
|
end
|
||||||
|
|
||||||
autorequire(:package) do
|
autorequire(:anchor) do
|
||||||
'trove-conductor'
|
['trove::install::end']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -46,7 +46,7 @@ Puppet::Type.newtype(:trove_config) do
|
|||||||
defaultto('<SERVICE DEFAULT>')
|
defaultto('<SERVICE DEFAULT>')
|
||||||
end
|
end
|
||||||
|
|
||||||
autorequire(:package) do
|
autorequire(:anchor) do
|
||||||
'trove-api'
|
['trove::install::end']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -46,7 +46,7 @@ Puppet::Type.newtype(:trove_guestagent_config) do
|
|||||||
defaultto('<SERVICE DEFAULT>')
|
defaultto('<SERVICE DEFAULT>')
|
||||||
end
|
end
|
||||||
|
|
||||||
autorequire(:package) do
|
autorequire(:anchor) do
|
||||||
'trove-guestagent'
|
['trove::install::end']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
24
spec/unit/type/trove_api_paste_ini_spec.rb
Normal file
24
spec/unit/type/trove_api_paste_ini_spec.rb
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
require 'puppet'
|
||||||
|
require 'puppet/type/trove_api_paste_ini'
|
||||||
|
|
||||||
|
describe 'Puppet::Type.type(:trove_api_paste_ini)' do
|
||||||
|
before :each do
|
||||||
|
@trove_api_paste_ini = Puppet::Type.type(:trove_api_paste_ini).new(:name => 'DEFAULT/foo', :value => 'bar')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should accept a valid value' do
|
||||||
|
@trove_api_paste_ini[:value] = 'bar'
|
||||||
|
expect(@trove_api_paste_ini[:value]).to eq('bar')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should autorequire the package that install the file' do
|
||||||
|
catalog = Puppet::Resource::Catalog.new
|
||||||
|
anchor = Puppet::Type.type(:anchor).new(:name => 'trove::install::end')
|
||||||
|
catalog.add_resource anchor, @trove_api_paste_ini
|
||||||
|
dependency = @trove_api_paste_ini.autorequire
|
||||||
|
expect(dependency.size).to eq(1)
|
||||||
|
expect(dependency[0].target).to eq(@trove_api_paste_ini)
|
||||||
|
expect(dependency[0].source).to eq(anchor)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -1,3 +1,4 @@
|
|||||||
|
require 'puppet'
|
||||||
require 'puppet/type/trove_conductor_config'
|
require 'puppet/type/trove_conductor_config'
|
||||||
|
|
||||||
describe 'Puppet::Type.type(:trove_conductor_config)' do
|
describe 'Puppet::Type.type(:trove_conductor_config)' do
|
||||||
@ -7,11 +8,11 @@ describe 'Puppet::Type.type(:trove_conductor_config)' do
|
|||||||
|
|
||||||
it 'should autorequire the package that installs the file' do
|
it 'should autorequire the package that installs the file' do
|
||||||
catalog = Puppet::Resource::Catalog.new
|
catalog = Puppet::Resource::Catalog.new
|
||||||
package = Puppet::Type.type(:package).new(:name => 'trove-conductor')
|
anchor = Puppet::Type.type(:anchor).new(:name => 'trove::install::end')
|
||||||
catalog.add_resource package, @trove_conductor_config
|
catalog.add_resource anchor, @trove_conductor_config
|
||||||
dependency = @trove_conductor_config.autorequire
|
dependency = @trove_conductor_config.autorequire
|
||||||
expect(dependency.size).to eq(1)
|
expect(dependency.size).to eq(1)
|
||||||
expect(dependency[0].target).to eq(@trove_conductor_config)
|
expect(dependency[0].target).to eq(@trove_conductor_config)
|
||||||
expect(dependency[0].source).to eq(package)
|
expect(dependency[0].source).to eq(anchor)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
require 'puppet'
|
||||||
require 'puppet/type/trove_guestagent_config'
|
require 'puppet/type/trove_guestagent_config'
|
||||||
|
|
||||||
describe 'Puppet::Type.type(:trove_guestagent_config)' do
|
describe 'Puppet::Type.type(:trove_guestagent_config)' do
|
||||||
@ -7,11 +8,11 @@ describe 'Puppet::Type.type(:trove_guestagent_config)' do
|
|||||||
|
|
||||||
it 'should autorequire the package that installs the file' do
|
it 'should autorequire the package that installs the file' do
|
||||||
catalog = Puppet::Resource::Catalog.new
|
catalog = Puppet::Resource::Catalog.new
|
||||||
package = Puppet::Type.type(:package).new(:name => 'trove-guestagent')
|
anchor = Puppet::Type.type(:anchor).new(:name => 'trove::install::end')
|
||||||
catalog.add_resource package, @trove_guestagent_config
|
catalog.add_resource anchor, @trove_guestagent_config
|
||||||
dependency = @trove_guestagent_config.autorequire
|
dependency = @trove_guestagent_config.autorequire
|
||||||
expect(dependency.size).to eq(1)
|
expect(dependency.size).to eq(1)
|
||||||
expect(dependency[0].target).to eq(@trove_guestagent_config)
|
expect(dependency[0].target).to eq(@trove_guestagent_config)
|
||||||
expect(dependency[0].source).to eq(package)
|
expect(dependency[0].source).to eq(anchor)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
require 'puppet'
|
require 'puppet'
|
||||||
require 'puppet/type/trove_config'
|
require 'puppet/type/trove_config'
|
||||||
|
|
||||||
describe 'Puppet::Type.type(:trove_config)' do
|
describe 'Puppet::Type.type(:trove_config)' do
|
||||||
before :each do
|
before :each do
|
||||||
@trove_config = Puppet::Type.type(:trove_config).new(:name => 'DEFAULT/foo', :value => 'bar')
|
@trove_config = Puppet::Type.type(:trove_config).new(:name => 'DEFAULT/foo', :value => 'bar')
|
||||||
@ -52,11 +53,11 @@ describe 'Puppet::Type.type(:trove_config)' do
|
|||||||
|
|
||||||
it 'should autorequire the package that installs the file' do
|
it 'should autorequire the package that installs the file' do
|
||||||
catalog = Puppet::Resource::Catalog.new
|
catalog = Puppet::Resource::Catalog.new
|
||||||
package = Puppet::Type.type(:package).new(:name => 'trove-api')
|
anchor = Puppet::Type.type(:anchor).new(:name => 'trove::install::end')
|
||||||
catalog.add_resource package, @trove_config
|
catalog.add_resource anchor, @trove_config
|
||||||
dependency = @trove_config.autorequire
|
dependency = @trove_config.autorequire
|
||||||
expect(dependency.size).to eq(1)
|
expect(dependency.size).to eq(1)
|
||||||
expect(dependency[0].target).to eq(@trove_config)
|
expect(dependency[0].target).to eq(@trove_config)
|
||||||
expect(dependency[0].source).to eq(package)
|
expect(dependency[0].source).to eq(anchor)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user