diff --git a/lib/puppet/type/zaqar_config.rb b/lib/puppet/type/zaqar_config.rb index ab1ecbc..45bc392 100644 --- a/lib/puppet/type/zaqar_config.rb +++ b/lib/puppet/type/zaqar_config.rb @@ -46,8 +46,8 @@ Puppet::Type.newtype(:zaqar_config) do defaultto('') end - autorequire(:package) do - 'zaqar-common' + autorequire(:anchor) do + ['zaqar::install::end'] end end diff --git a/spec/unit/type/zaqar_config_spec.rb b/spec/unit/type/zaqar_config_spec.rb index 832efcc..9978e36 100644 --- a/spec/unit/type/zaqar_config_spec.rb +++ b/spec/unit/type/zaqar_config_spec.rb @@ -49,4 +49,15 @@ describe 'Puppet::Type.type(:zaqar_config)' do @zaqar_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 => 'zaqar::install::end') + catalog.add_resource anchor, @zaqar_config + dependency = @zaqar_config.autorequire + expect(dependency.size).to eq(1) + expect(dependency[0].target).to eq(@zaqar_config) + expect(dependency[0].source).to eq(anchor) + end + end