Remove `update['always'] = true` support
[puppet-modules/puppetlabs-apt.git] / manifests / params.pp
1 class apt::params {
2
3   if $::osfamily != 'Debian' {
4     fail('This module only works on Debian or derivatives like Ubuntu')
5   }
6
7   # Strict variables facts lookup compatibility
8   $xfacts = {
9     'lsbdistcodename' => defined('$lsbdistcodename') ? {
10       true    => $::lsbdistcodename,
11       default => undef,
12     },
13     'lsbdistrelease' => defined('$lsbdistrelease') ? {
14       true    => $::lsbdistrelease,
15       default => undef,
16     },
17     'lsbmajdistrelease' => defined('$lsbmajdistrelease') ? {
18       true    => $::lsbmajdistrelease,
19       default => undef,
20     },
21     'lsbdistdescription' => defined('$lsbdistdescription') ? {
22       true    => $::lsbdistdescription,
23       default => undef,
24     },
25     'lsbminordistrelease' => defined('$lsbminordistrelease') ? {
26       true    => $::lsbminordistrelease,
27       default => undef,
28     },
29     'lsbdistid' => defined('$lsbdistid') ? {
30       true    => $::lsbdistid,
31       default => undef,
32     },
33   }
34
35   $root           = '/etc/apt'
36   $provider       = '/usr/bin/apt-get'
37   $sources_list   = "${root}/sources.list"
38   $sources_list_d = "${root}/sources.list.d"
39   $conf_d         = "${root}/apt.conf.d"
40   $preferences    = "${root}/preferences"
41   $preferences_d  = "${root}/preferences.d"
42   $keyserver      = 'keyserver.ubuntu.com'
43
44   $config_files = {
45     'conf'   => {
46       'path' => $conf_d,
47       'ext'  => '',
48     },
49     'pref'   => {
50       'path' => $preferences_d,
51       'ext'  => '',
52     },
53     'list'   => {
54       'path' => $sources_list_d,
55       'ext'  => '.list',
56     }
57   }
58
59   $update_defaults = {
60     'frequency' => 'reluctantly',
61     'timeout'   => undef,
62     'tries'     => undef,
63   }
64
65   $proxy_defaults = {
66     'host'  => undef,
67     'port'  => 8080,
68     'https' => false,
69   }
70
71   $purge_defaults = {
72     'sources.list'   => true,
73     'sources.list.d' => true,
74     'preferences'    => true,
75     'preferences.d'  => true,
76   }
77
78   $source_key_defaults = {
79     'server'  => $keyserver,
80     'options' => undef,
81     'content' => undef,
82     'source'  => undef,
83   }
84
85   $include_defaults = {
86     'deb' => true,
87     'src' => false,
88   }
89
90   case $xfacts['lsbdistid'] {
91     'ubuntu', 'debian': {
92       $distid = $xfacts['lsbdistid']
93       $distcodename = $xfacts['lsbdistcodename']
94     }
95     'linuxmint': {
96       if $xfacts['lsbdistcodename'] == 'debian' {
97         $distid = 'debian'
98         $distcodename = 'wheezy'
99       } else {
100         $distid = 'ubuntu'
101         $distcodename = $xfacts['lsbdistcodename'] ? {
102           'qiana'  => 'trusty',
103           'petra'  => 'saucy',
104           'olivia' => 'raring',
105           'nadia'  => 'quantal',
106           'maya'   => 'precise',
107         }
108       }
109     }
110     undef: {
111       fail('Unable to determine lsbdistid, is lsb-release installed?')
112     }
113     default: {
114       fail("Unsupported lsbdistid (${::lsbdistid})")
115     }
116   }
117   case $distid {
118     'ubuntu': {
119       case $distcodename {
120         'lucid': {
121           $ppa_options        = undef
122           $ppa_package        = 'python-software-properties'
123         }
124         'precise': {
125           $ppa_options        = '-y'
126           $ppa_package        = 'python-software-properties'
127         }
128         'trusty', 'utopic', 'vivid': {
129           $ppa_options        = '-y'
130           $ppa_package        = 'software-properties-common'
131         }
132         default: {
133           $ppa_options        = '-y'
134           $ppa_package        = 'software-properties-common'
135         }
136       }
137     }
138     '', default: {
139       $ppa_options = undef
140       $ppa_package = undef
141     }
142   }
143 }