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