diff --git a/lib/puppet/type/ironic_api_paste_ini.rb b/lib/puppet/type/ironic_api_paste_ini.rb index a5a8012f..ceb0b685 100644 --- a/lib/puppet/type/ironic_api_paste_ini.rb +++ b/lib/puppet/type/ironic_api_paste_ini.rb @@ -45,8 +45,8 @@ Puppet::Type.newtype(:ironic_api_paste_ini) do defaultto('') end - autorequire(:package) do - 'ironic' + autorequire(:anchor) do + ['ironic::install::end'] end end diff --git a/lib/puppet/type/ironic_config.rb b/lib/puppet/type/ironic_config.rb index acd60414..dfab0d77 100644 --- a/lib/puppet/type/ironic_config.rb +++ b/lib/puppet/type/ironic_config.rb @@ -48,8 +48,8 @@ Puppet::Type.newtype(:ironic_config) do newparam(:transform_to) - autorequire(:package) do - 'ironic-common' + autorequire(:anchor) do + ['ironic::install::end'] end end diff --git a/lib/puppet/type/ironic_inspector_config.rb b/lib/puppet/type/ironic_inspector_config.rb index fe7ff166..69f0be1f 100644 --- a/lib/puppet/type/ironic_inspector_config.rb +++ b/lib/puppet/type/ironic_inspector_config.rb @@ -46,8 +46,8 @@ Puppet::Type.newtype(:ironic_inspector_config) do defaultto('') end - autorequire(:package) do - 'ironic-inspector' + autorequire(:anchor) do + ['ironic::install::end'] end end diff --git a/spec/unit/type/ironic_api_paste_ini_spec.rb b/spec/unit/type/ironic_api_paste_ini_spec.rb index 68a7721f..eb04d106 100644 --- a/spec/unit/type/ironic_api_paste_ini_spec.rb +++ b/spec/unit/type/ironic_api_paste_ini_spec.rb @@ -1,21 +1,11 @@ -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/ironic_api_paste_ini' + describe 'Puppet::Type.type(:ironic_api_paste_ini)' do before :each do @ironic_api_paste_ini = Puppet::Type.type(:ironic_api_paste_ini).new(:name => 'DEFAULT/foo', :value => 'bar') end + it 'should accept a valid value' do @ironic_api_paste_ini[:value] = 'bar' expect(@ironic_api_paste_ini[:value]).to eq('bar') @@ -23,12 +13,12 @@ describe 'Puppet::Type.type(:ironic_api_paste_ini)' do it 'should autorequire the package that install the file' do catalog = Puppet::Resource::Catalog.new - package = Puppet::Type.type(:package).new(:name => 'ironic') - catalog.add_resource package, @ironic_api_paste_ini + anchor = Puppet::Type.type(:anchor).new(:name => 'ironic::install::end') + catalog.add_resource anchor, @ironic_api_paste_ini dependency = @ironic_api_paste_ini.autorequire expect(dependency.size).to eq(1) expect(dependency[0].target).to eq(@ironic_api_paste_ini) - expect(dependency[0].source).to eq(package) + expect(dependency[0].source).to eq(anchor) end end diff --git a/spec/unit/type/ironic_config_spec.rb b/spec/unit/type/ironic_config_spec.rb index 1e0a15a7..7163d27e 100644 --- a/spec/unit/type/ironic_config_spec.rb +++ b/spec/unit/type/ironic_config_spec.rb @@ -53,12 +53,12 @@ describe 'Puppet::Type.type(:ironic_config)' do it 'should autorequire the package that install the file' do catalog = Puppet::Resource::Catalog.new - package = Puppet::Type.type(:package).new(:name => 'ironic-common') - catalog.add_resource package, @ironic_config + anchor = Puppet::Type.type(:anchor).new(:name => 'ironic::install::end') + catalog.add_resource anchor, @ironic_config dependency = @ironic_config.autorequire expect(dependency.size).to eq(1) expect(dependency[0].target).to eq(@ironic_config) - expect(dependency[0].source).to eq(package) + expect(dependency[0].source).to eq(anchor) end end diff --git a/spec/unit/type/ironic_inspector_config_spec.rb b/spec/unit/type/ironic_inspector_config_spec.rb index 5d37e35f..433c21ec 100644 --- a/spec/unit/type/ironic_inspector_config_spec.rb +++ b/spec/unit/type/ironic_inspector_config_spec.rb @@ -8,12 +8,12 @@ describe 'Puppet::Type.type(:ironic_inspector_config)' do it 'should autorequire the package that install the file' do catalog = Puppet::Resource::Catalog.new - package = Puppet::Type.type(:package).new(:name => 'ironic-inspector') - catalog.add_resource package, @ironic_inspector_config + anchor = Puppet::Type.type(:anchor).new(:name => 'ironic::install::end') + catalog.add_resource anchor, @ironic_inspector_config dependency = @ironic_inspector_config.autorequire expect(dependency.size).to eq(1) expect(dependency[0].target).to eq(@ironic_inspector_config) - expect(dependency[0].source).to eq(package) + expect(dependency[0].source).to eq(anchor) end end