(maint) make apt testing more stable, cleanup
[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           $backports = {
78             'location' => 'http://deb.debian.org/debian',
79             'key'      => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
80             'repos'    => 'main contrib non-free',
81           }
82       $ppa_options = undef
83       $ppa_package = undef
84     }
85     'Ubuntu': {
86       $backports = {
87         'location' => 'http://archive.ubuntu.com/ubuntu',
88         'key'      => '630239CC130E1A7FD81A27B140976EAF437D05B5',
89         'repos'    => 'main universe multiverse restricted',
90       }
91       $ppa_options        = '-y'
92       $ppa_package        = 'software-properties-common'
93     }
94     undef: {
95       fail('Unable to determine value for fact os["name"]')
96     }
97     default: {
98       $ppa_options = undef
99       $ppa_package = undef
100       $backports   = undef
101     }
102   }
103 }