From e8977deea10bfa3f9e707ad8b859372d7e087378 Mon Sep 17 00:00:00 2001 From: Nan Liu Date: Fri, 4 May 2012 13:56:35 -0700 Subject: [PATCH] (#14321) apt::pin resource support release. apt::pin release should default to title, but should be able to override. This update removes unnecessary "" around $name, and add spec tests. Conflicts: spec/defines/pin_spec.rb --- manifests/pin.pp | 2 +- spec/defines/pin_spec.rb | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/manifests/pin.pp b/manifests/pin.pp index 7356a67..29fddfb 100644 --- a/manifests/pin.pp +++ b/manifests/pin.pp @@ -5,7 +5,7 @@ define apt::pin( $ensure = present, $packages = '*', $priority = 0, - $release = "${name}" + $release = $name ) { include apt::params diff --git a/spec/defines/pin_spec.rb b/spec/defines/pin_spec.rb index c5d3fd9..b5b10d7 100644 --- a/spec/defines/pin_spec.rb +++ b/spec/defines/pin_spec.rb @@ -6,7 +6,8 @@ describe 'apt::pin', :type => :define do { :ensure => 'present', :packages => '*', - :priority => '0' + :priority => '0', + :release => nil } end @@ -19,6 +20,11 @@ describe 'apt::pin', :type => :define do :ensure => 'absent', :packages => 'apache', :priority => '1' + }, + { + :packages => 'apache', + :priority => '1', + :release => 'my_newpin' } ].each do |param_set| describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do @@ -38,7 +44,7 @@ describe 'apt::pin', :type => :define do 'owner' => 'root', 'group' => 'root', 'mode' => '0644', - 'content' => "# #{title}\nPackage: #{param_hash[:packages]}\nPin: release a=#{title}\nPin-Priority: #{param_hash[:priority]}", + 'content' => "# #{title}\nPackage: #{param_hash[:packages]}\nPin: release a=#{param_hash[:release] || title}\nPin-Priority: #{param_hash[:priority]}", }) } end -- 2.45.2