* `settings`: Creates new `apt::setting` resources. Valid options: a hash to be passed to the [`create_resources` function](https://docs.puppetlabs.com/references/latest/function.html#createresources). Default: {}.
-* `sources`: Creates new `apt::setting` resources. Valid options: a hash to be passed to the [`create_resources` function](https://docs.puppetlabs.com/references/latest/function.html#createresources). Default: {}.
+* `sources`: Creates new `apt::source` resources. Valid options: a hash to be passed to the [`create_resources` function](https://docs.puppetlabs.com/references/latest/function.html#createresources). Default: {}.
+
+* `pins`: Creates new `apt::pin` resources. Valid options: a hash to be passed to the [`create_resources` function](https://docs.puppetlabs.com/references/latest/function.html#createresources). Default: {}.
* `update`: Configures various update settings. Valid options: a hash made up from the following keys:
$sources = {},
$keys = {},
$ppas = {},
+ $pins = {},
$settings = {},
) inherits ::apt::params {
validate_hash($keys)
validate_hash($settings)
validate_hash($ppas)
+ validate_hash($pins)
if $_proxy['ensure'] == 'absent' or $_proxy['host'] {
apt::setting { 'conf-proxy':
if $settings {
create_resources('apt::setting', $settings)
}
+
+ # manage pins if present
+ if $pins {
+ create_resources('apt::pin', $pins)
+ }
}
it { is_expected.to contain_apt__setting('pref-banana')}
end
+ context 'with pins defined on valid osfamily' do
+ let :facts do
+ { :osfamily => 'Debian',
+ :lsbdistcodename => 'precise',
+ :lsbdistid => 'Debian',
+ :puppetversion => Puppet.version,
+ }
+ end
+ let(:params) { { :pins => {
+ 'stable' => { 'priority' => 600, 'order' => 50 },
+ 'testing' => { 'priority' => 700, 'order' => 100 },
+ } } }
+
+ it { is_expected.to contain_apt__pin('stable') }
+ it { is_expected.to contain_apt__pin('testing') }
+ end
+
describe 'failing tests' do
context "purge['sources.list']=>'banana'" do
let(:params) { { :purge => { 'sources.list' => 'banana' }, } }