]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/blob - manifests/params.pp
8799f7b98e8be829aaa1bd741b042da9a73f8a37
[puppet-modules/puppetlabs-apt.git] / manifests / params.pp
1 class apt::params {
2
3   if $caller_module_name and $caller_module_name != $module_name {
4     fail('apt::params is a private class and cannot be accessed directly')
5   }
6
7   $root           = '/etc/apt'
8   $provider       = '/usr/bin/apt-get'
9   $sources_list   = "${root}/sources.list"
10   $sources_list_d = "${root}/sources.list.d"
11   $conf_d         = "${root}/apt.conf.d"
12   $preferences    = "${root}/preferences"
13   $preferences_d  = "${root}/preferences.d"
14
15   if $::osfamily != 'Debian' {
16     fail('This module only works on Debian or derivatives like Ubuntu')
17   }
18
19   $config_files = {
20     'conf'   => {
21       'path' => $conf_d,
22       'ext'  => '',
23     },
24     'pref'   => {
25       'path' => $preferences_d,
26       'ext'  => '',
27     },
28     'list'   => {
29       'path' => $sources_list_d,
30       'ext'  => '.list',
31     }
32   }
33
34   $update_defaults = {
35     'always'    => false,
36     'frequency' => 'reluctantly',
37     'timeout'   => undef,
38     'tries'     => undef,
39   }
40
41   $proxy_defaults = {
42     'host'  => undef,
43     'port'  => 8080,
44     'https' => false,
45   }
46
47   $purge_defaults = {
48     'sources.list'   => true,
49     'sources.list.d' => true,
50     'preferences'    => true,
51     'preferences.d'  => true,
52   }
53
54   $source_key_defaults = {
55     'server'  => $default_keyserver,
56     'options' => undef,
57     'content' => undef,
58     'source'  => undef,
59   }
60
61   $file_defaults = {
62     'owner' => 'root',
63     'group' => 'root',
64     'mode'  => '0644',
65   }
66
67   case $::lsbdistid {
68     'ubuntu', 'debian': {
69       $distid = $::lsbdistid
70       $distcodename = $::lsbdistcodename
71     }
72     'linuxmint': {
73       if $::lsbdistcodename == 'debian' {
74         $distid = 'debian'
75         $distcodename = 'wheezy'
76       } else {
77         $distid = 'ubuntu'
78         $distcodename = $::lsbdistcodename ? {
79           'qiana'  => 'trusty',
80           'petra'  => 'saucy',
81           'olivia' => 'raring',
82           'nadia'  => 'quantal',
83           'maya'   => 'precise',
84         }
85       }
86     }
87     '': {
88       fail('Unable to determine lsbdistid, is lsb-release installed?')
89     }
90     default: {
91       fail("Unsupported lsbdistid (${::lsbdistid})")
92     }
93   }
94   case $distid {
95     'ubuntu': {
96       case $distcodename {
97         'lucid': {
98           $ppa_options        = undef
99           $ppa_package        = 'python-software-properties'
100         }
101         'precise': {
102           $ppa_options        = '-y'
103           $ppa_package        = 'python-software-properties'
104         }
105         'trusty', 'utopic', 'vivid': {
106           $ppa_options        = '-y'
107           $ppa_package        = 'software-properties-common'
108         }
109         default: {
110           $ppa_options        = '-y'
111           $ppa_package        = 'software-properties-common'
112         }
113       }
114     }
115   }
116 }