Merge pull request #739 from pmcmaw/puppet-lint_warn
[puppet-modules/puppetlabs-apt.git] / manifests / params.pp
1 # Setting params for the module
2 class apt::params {
3
4   if $::osfamily != 'Debian' {
5     fail('This module only works on Debian or derivatives like Ubuntu')
6   }
7
8   $root           = '/etc/apt'
9   $provider       = '/usr/bin/apt-get'
10   $sources_list   = "${root}/sources.list"
11   $sources_list_d = "${root}/sources.list.d"
12   $conf_d         = "${root}/apt.conf.d"
13   $preferences    = "${root}/preferences"
14   $preferences_d  = "${root}/preferences.d"
15   $keyserver      = 'keyserver.ubuntu.com'
16   $confs          = {}
17   $update         = {}
18   $purge          = {}
19   $proxy          = {}
20   $sources        = {}
21   $keys           = {}
22   $ppas           = {}
23   $pins           = {}
24   $settings       = {}
25
26   $config_files = {
27     'conf'   => {
28       'path' => $conf_d,
29       'ext'  => '',
30     },
31     'pref'   => {
32       'path' => $preferences_d,
33       'ext'  => '.pref',
34     },
35     'list'   => {
36       'path' => $sources_list_d,
37       'ext'  => '.list',
38     }
39   }
40
41   $update_defaults = {
42     'frequency' => 'reluctantly',
43     'loglevel'  => undef,
44     'timeout'   => undef,
45     'tries'     => undef,
46   }
47
48   $proxy_defaults = {
49     'ensure' => undef,
50     'host'   => undef,
51     'port'   => 8080,
52     'https'  => false,
53     'direct' => false,
54   }
55
56   $purge_defaults = {
57     'sources.list'   => false,
58     'sources.list.d' => false,
59     'preferences'    => false,
60     'preferences.d'  => false,
61   }
62
63   $source_key_defaults = {
64     'server'  => $keyserver,
65     'options' => undef,
66     'content' => undef,
67     'source'  => undef,
68   }
69
70   $include_defaults = {
71     'deb' => true,
72     'src' => false,
73   }
74
75   case $facts['os']['name']{
76     'Debian': {
77       case $facts['os']['release']['full'] {
78         default: {
79           $backports = {
80             'location' => 'http://deb.debian.org/debian',
81             'key'      => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
82             'repos'    => 'main contrib non-free',
83           }
84         }
85       }
86
87       $ppa_options = undef
88       $ppa_package = undef
89
90     }
91     'Ubuntu': {
92       $backports = {
93         'location' => 'http://archive.ubuntu.com/ubuntu',
94         'key'      => '630239CC130E1A7FD81A27B140976EAF437D05B5',
95         'repos'    => 'main universe multiverse restricted',
96       }
97
98       case $facts['os']['release']['full'] {
99         '10.04': {
100           $ppa_options        = undef
101           $ppa_package        = 'python-software-properties'
102         }
103         '12.04': {
104           $ppa_options        = '-y'
105           $ppa_package        = 'python-software-properties'
106         }
107         '14.04', '14.10', '15.04', '15.10', '16.04': {
108           $ppa_options        = '-y'
109           $ppa_package        = 'software-properties-common'
110         }
111         default: {
112           $ppa_options        = '-y'
113           $ppa_package        = 'python-software-properties'
114         }
115       }
116     }
117     undef: {
118       fail('Unable to determine value for fact os["name"]')
119     }
120     default: {
121       $ppa_options = undef
122       $ppa_package = undef
123       $backports   = undef
124     }
125   }
126 }