apt::pin: Allow for packages to be an array.
label => 'Debian'
}
+If you wish to pin a number of packages you may specify the packages as a space
+delimited string using the `packages` attribute or pass in an array of package
+names.
+
### apt::ppa
Adds a ppa repository using `add-apt-repository`.
# Read the manpage 'apt_preferences(5)', especially the chapter
# 'Thea Effect of APT Preferences' to understand the following logic
# and the difference between specific and general form
- if $packages != '*' { # specific form
+ if is_array($packages) {
+ $packages_string = join($packages, ' ')
+ } else {
+ $packages_string = $packages
+ }
+
+ if $packages_string != '*' { # specific form
if ( $pin_release != '' and ( $origin != '' or $version != '' )) or
( $origin != '' and ( $pin_release != '' or $version != '' )) or
hypervisor : vagrant
CONFIG:
type: foss
+ vagrant_ssh_port_random: true
it { should contain 'Pin: release a=vim-puppet' }
end
end
+
+ context 'array' do
+ it 'should work with no errors' do
+ pp = <<-EOS
+ include apt
+ apt::pin { 'array':
+ ensure => present,
+ packages => ['apache', 'ntop'],
+ }
+ EOS
+
+ apply_manifest(pp, :catch_failures => true)
+ end
+
+ describe file('/etc/apt/preferences.d/array.pref') do
+ it { should be_file }
+ it { should contain 'Package: apache ntop' }
+ it { should contain 'Pin: release a=array' }
+ end
+ end
end
context 'release' do
{
:params => {
:packages => 'apache',
- :priority => '1',
+ :priority => '1',
:release => 'stable',
:codename => 'wheezy',
:release_version => '3.0',
},
:content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=stable, n=wheezy, v=3.0, c=main, o=Debian, l=Debian\nPin-Priority: 1\n"
},
+ {
+ :params => {
+ :packages => ['apache', 'ntop'],
+ },
+ :content => "# my_pin\nExplanation: : my_pin\nPackage: apache ntop\nPin: release a=my_pin\nPin-Priority: 0\n"
+ },
].each do |param_set|
describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do
let :param_hash do
-%>
# <%= @name %>
Explanation: <%= @explanation %>
-Package: <%= @packages %>
+Package: <%= @packages_string %>
Pin: <%= @pin %>
Pin-Priority: <%= @priority %>