Merge pull request #84 from dalen/pin_version
[puppet-modules/puppetlabs-apt.git] / manifests / backports.pp
1 # This adds the necessary components to get backports for ubuntu and debian
2 #
3 # == Parameters
4 #
5 # [*release*]
6 #   The ubuntu/debian release name. Defaults to $lsbdistcodename. Setting this
7 #   manually can cause undefined behavior. (Read: universe exploding)
8 #
9 # == Examples
10 #
11 #   include apt::backports
12 #
13 #   class { 'apt::backports':
14 #     release => 'natty',
15 #   }
16 #
17 # == Authors
18 #
19 # Ben Hughes, I think. At least blame him if this goes wrong.
20 # I just added puppet doc.
21 #
22 # == Copyright
23 #
24 # Copyright 2011 Puppet Labs Inc, unless otherwise noted.
25 class apt::backports(
26   $release  = $::lsbdistcodename,
27   $location = $apt::params::backports_location
28 ) inherits apt::params {
29
30   $release_real = downcase($release)
31   $key = $::lsbdistid ? {
32     'debian' => '55BE302B',
33     'ubuntu' => '437D05B5',
34   }
35   $repos = $::lsbdistid ? {
36     'debian' => 'main contrib non-free',
37     'ubuntu' => 'main universe multiverse restricted',
38   }
39
40   apt::source { 'backports':
41     location   => $location,
42     release    => "${release_real}-backports",
43     repos      => $repos,
44     key        => $key,
45     key_server => 'pgp.mit.edu',
46     pin        => '200',
47   }
48 }