Browse Source

Use anchor to require necessary packages

... so that correct packages are required without re-defining them in
resource implementations.

Change-Id: I536d77e157d96211e317297cefd321d6a7d6a98f
changes/75/725175/1
Takashi Kajinami 1 year ago
parent
commit
a503ac22c3
  1. 4
      lib/puppet/type/murano_cfapi_config.rb
  2. 4
      lib/puppet/type/murano_cfapi_paste_ini_config.rb
  3. 4
      lib/puppet/type/murano_config.rb
  4. 5
      lib/puppet/type/murano_paste_ini_config.rb
  5. 7
      spec/unit/type/murano_cfapi_config_spec.rb
  6. 7
      spec/unit/type/murano_cfapi_paste_ini_config_spec.rb
  7. 7
      spec/unit/type/murano_config_spec.rb
  8. 7
      spec/unit/type/murano_paste_ini_config_spec.rb

4
lib/puppet/type/murano_cfapi_config.rb

@ -45,7 +45,7 @@ Puppet::Type.newtype(:murano_cfapi_config) do
defaultto('<SERVICE DEFAULT>')
end
autorequire(:package) do
'murano-common'
autorequire(:anchor) do
['murano::install::end']
end
end

4
lib/puppet/type/murano_cfapi_paste_ini_config.rb

@ -45,7 +45,7 @@ Puppet::Type.newtype(:murano_cfapi_paste_ini_config) do
defaultto('<SERVICE DEFAULT>')
end
autorequire(:package) do
'murano-common'
autorequire(:anchor) do
['murano::install::end']
end
end

4
lib/puppet/type/murano_config.rb

@ -45,7 +45,7 @@ Puppet::Type.newtype(:murano_config) do
defaultto('<SERVICE DEFAULT>')
end
autorequire(:package) do
'murano-common'
autorequire(:anchor) do
['murano::install::end']
end
end

5
lib/puppet/type/murano_paste_ini_config.rb

@ -45,7 +45,8 @@ Puppet::Type.newtype(:murano_paste_ini_config) do
defaultto('<SERVICE DEFAULT>')
end
autorequire(:package) do
'murano-common'
autorequire(:anchor) do
['murano::install::end']
end
end

7
spec/unit/type/murano_cfapi_config_spec.rb

@ -1,5 +1,6 @@
require 'puppet'
require 'puppet/type/murano_cfapi_config'
describe 'Puppet::Type.type(:murano_cfapi_config)' do
before :each do
@murano_cfapi_config = Puppet::Type.type(:murano_cfapi_config).new(:name => 'DEFAULT/foo', :value => 'bar')
@ -52,11 +53,11 @@ describe 'Puppet::Type.type(:murano_cfapi_config)' do
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'murano-common')
catalog.add_resource package, @murano_cfapi_config
anchor = Puppet::Type.type(:anchor).new(:name => 'murano::install::end')
catalog.add_resource anchor, @murano_cfapi_config
dependency = @murano_cfapi_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@murano_cfapi_config)
expect(dependency[0].source).to eq(package)
expect(dependency[0].source).to eq(anchor)
end
end

7
spec/unit/type/murano_cfapi_paste_ini_config_spec.rb

@ -1,5 +1,6 @@
require 'puppet'
require 'puppet/type/murano_cfapi_paste_ini_config'
describe 'Puppet::Type.type(:murano_cfapi_paste_ini_config)' do
before :each do
@murano_cfapi_paste_ini_config = Puppet::Type.type(:murano_cfapi_paste_ini_config).new(:name => 'DEFAULT/foo', :value => 'bar')
@ -52,11 +53,11 @@ describe 'Puppet::Type.type(:murano_cfapi_paste_ini_config)' do
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'murano-common')
catalog.add_resource package, @murano_cfapi_paste_ini_config
anchor = Puppet::Type.type(:anchor).new(:name => 'murano::install::end')
catalog.add_resource anchor, @murano_cfapi_paste_ini_config
dependency = @murano_cfapi_paste_ini_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@murano_cfapi_paste_ini_config)
expect(dependency[0].source).to eq(package)
expect(dependency[0].source).to eq(anchor)
end
end

7
spec/unit/type/murano_config_spec.rb

@ -1,5 +1,6 @@
require 'puppet'
require 'puppet/type/murano_config'
describe 'Puppet::Type.type(:murano_config)' do
before :each do
@murano_config = Puppet::Type.type(:murano_config).new(:name => 'DEFAULT/foo', :value => 'bar')
@ -52,11 +53,11 @@ describe 'Puppet::Type.type(:murano_config)' do
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'murano-common')
catalog.add_resource package, @murano_config
anchor = Puppet::Type.type(:anchor).new(:name => 'murano::install::end')
catalog.add_resource anchor, @murano_config
dependency = @murano_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@murano_config)
expect(dependency[0].source).to eq(package)
expect(dependency[0].source).to eq(anchor)
end
end

7
spec/unit/type/murano_paste_ini_config_spec.rb

@ -1,5 +1,6 @@
require 'puppet'
require 'puppet/type/murano_paste_ini_config'
describe 'Puppet::Type.type(:murano_paste_ini_config)' do
before :each do
@murano_paste_ini_config = Puppet::Type.type(:murano_paste_ini_config).new(:name => 'DEFAULT/foo', :value => 'bar')
@ -52,11 +53,11 @@ describe 'Puppet::Type.type(:murano_paste_ini_config)' do
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'murano-common')
catalog.add_resource package, @murano_paste_ini_config
anchor = Puppet::Type.type(:anchor).new(:name => 'murano::install::end')
catalog.add_resource anchor, @murano_paste_ini_config
dependency = @murano_paste_ini_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@murano_paste_ini_config)
expect(dependency[0].source).to eq(package)
expect(dependency[0].source).to eq(anchor)
end
end
Loading…
Cancel
Save