|
31 | 31 | # See apt::backports for documentation.
|
32 | 32 | #
|
33 | 33 | # @param confs
|
34 |
| -# Creates new `apt::conf` resources. Valid options: a hash to be passed to the create_resources function linked above. |
| 34 | +# Hash of `apt::conf` resources. |
35 | 35 | #
|
36 | 36 | # @param update
|
37 | 37 | # Configures various update settings. Valid options: a hash made up from the following keys:
|
|
85 | 85 | # The default proxy settings that are combined and merged with the passed `proxy` value
|
86 | 86 | #
|
87 | 87 | # @param sources
|
88 |
| -# Creates new `apt::source` resources. Valid options: a hash to be passed to the create_resources function linked above. |
| 88 | +# Hash of `apt::source` resources. |
89 | 89 | #
|
90 | 90 | # @param keys
|
91 |
| -# Creates new `apt::key` resources. Valid options: a hash to be passed to the create_resources function linked above. |
| 91 | +# Hash of `apt::key` resources. |
92 | 92 | #
|
93 | 93 | # @param keyrings
|
94 | 94 | # Hash of `apt::keyring` resources.
|
95 | 95 | #
|
96 | 96 | # @param ppas
|
97 |
| -# Creates new `apt::ppa` resources. Valid options: a hash to be passed to the create_resources function linked above. |
| 97 | +# Hash of `apt::ppa` resources. |
98 | 98 | #
|
99 | 99 | # @param pins
|
100 |
| -# Creates new `apt::pin` resources. Valid options: a hash to be passed to the create_resources function linked above. |
| 100 | +# Hash of `apt::pin` resources. |
101 | 101 | #
|
102 | 102 | # @param settings
|
103 |
| -# Creates new `apt::setting` resources. Valid options: a hash to be passed to the create_resources function linked above. |
| 103 | +# Hash of `apt::setting` resources. |
104 | 104 | #
|
105 | 105 | # @param manage_auth_conf
|
106 | 106 | # Specifies whether to manage the /etc/apt/auth.conf file. When true, the file will be overwritten with the entries specified in
|
|
113 | 113 | # password and no others. Specifying manage_auth_conf and not specifying this parameter will set /etc/apt/auth.conf to absent.
|
114 | 114 | #
|
115 | 115 | # @param auth_conf_owner
|
116 |
| -# The owner of the file /etc/apt/auth.conf. Default: '_apt' or 'root' on old releases. |
| 116 | +# The owner of the file /etc/apt/auth.conf. |
117 | 117 | #
|
118 | 118 | # @param root
|
119 | 119 | # Specifies root directory of Apt executable.
|
|
137 | 137 | # A hash made up of the various configuration files used by Apt.
|
138 | 138 | #
|
139 | 139 | # @param sources_list_force
|
140 |
| -# Specifies whether to perform force purge or delete. Default false. |
| 140 | +# Specifies whether to perform force purge or delete. |
141 | 141 | #
|
142 | 142 | # @param include_defaults
|
| 143 | +# The package types to include by default. |
143 | 144 | #
|
144 | 145 | # @param apt_conf_d
|
145 | 146 | # The path to the file `apt.conf.d`
|
|
148 | 149 | # The fault `source_key` settings
|
149 | 150 | #
|
150 | 151 | class apt (
|
151 |
| - Hash $update_defaults = $apt::params::update_defaults, |
152 |
| - Hash $purge_defaults = $apt::params::purge_defaults, |
153 |
| - Hash $proxy_defaults = $apt::params::proxy_defaults, |
154 |
| - Hash $include_defaults = $apt::params::include_defaults, |
155 |
| - String $provider = $apt::params::provider, |
156 |
| - String $keyserver = $apt::params::keyserver, |
157 |
| - Optional[String] $key_options = $apt::params::key_options, |
158 |
| - Optional[Array[String]] $ppa_options = $apt::params::ppa_options, |
159 |
| - Optional[String] $ppa_package = $apt::params::ppa_package, |
160 |
| - Optional[Hash] $backports = $apt::params::backports, |
161 |
| - Hash $confs = $apt::params::confs, |
162 |
| - Hash $update = $apt::params::update, |
163 |
| - Hash $purge = $apt::params::purge, |
164 |
| - Apt::Proxy $proxy = $apt::params::proxy, |
165 |
| - Hash $sources = $apt::params::sources, |
166 |
| - Hash $keys = $apt::params::keys, |
167 |
| - Hash $keyrings = {}, |
168 |
| - Hash $ppas = $apt::params::ppas, |
169 |
| - Hash $pins = $apt::params::pins, |
170 |
| - Hash $settings = $apt::params::settings, |
171 |
| - Boolean $manage_auth_conf = $apt::params::manage_auth_conf, |
172 |
| - Array[Apt::Auth_conf_entry] $auth_conf_entries = $apt::params::auth_conf_entries, |
173 |
| - String $auth_conf_owner = $apt::params::auth_conf_owner, |
174 |
| - String $root = $apt::params::root, |
175 |
| - String $sources_list = $apt::params::sources_list, |
176 |
| - String $sources_list_d = $apt::params::sources_list_d, |
177 |
| - String $conf_d = $apt::params::conf_d, |
178 |
| - String $preferences = $apt::params::preferences, |
179 |
| - String $preferences_d = $apt::params::preferences_d, |
180 |
| - String $apt_conf_d = $apt::params::apt_conf_d, |
181 |
| - Hash $config_files = $apt::params::config_files, |
182 |
| - Boolean $sources_list_force = $apt::params::sources_list_force, |
183 |
| - |
| 152 | + Hash $update_defaults = { |
| 153 | + 'frequency' => 'reluctantly', |
| 154 | + 'loglevel' => undef, |
| 155 | + 'timeout' => undef, |
| 156 | + 'tries' => undef, |
| 157 | + }, |
| 158 | + Hash $purge_defaults = { |
| 159 | + 'sources.list' => false, |
| 160 | + 'sources.list.d' => false, |
| 161 | + 'preferences' => false, |
| 162 | + 'preferences.d' => false, |
| 163 | + 'apt.conf.d' => false, |
| 164 | + }, |
| 165 | + Hash $proxy_defaults = { |
| 166 | + 'ensure' => undef, |
| 167 | + 'host' => undef, |
| 168 | + 'port' => 8080, |
| 169 | + 'https' => false, |
| 170 | + 'https_acng' => false, |
| 171 | + 'direct' => false, |
| 172 | + }, |
| 173 | + Hash $include_defaults = { |
| 174 | + 'deb' => true, |
| 175 | + 'src' => false, |
| 176 | + }, |
| 177 | + String $provider = '/usr/bin/apt-get', |
| 178 | + String $keyserver = 'keyserver.ubuntu.com', |
| 179 | + Optional[String] $key_options = undef, |
| 180 | + Optional[Array[String]] $ppa_options = undef, |
| 181 | + Optional[String] $ppa_package = undef, |
| 182 | + Optional[Hash] $backports = undef, |
| 183 | + Hash $confs = {}, |
| 184 | + Hash $update = {}, |
| 185 | + Hash $purge = {}, |
| 186 | + Apt::Proxy $proxy = {}, |
| 187 | + Hash $sources = {}, |
| 188 | + Hash $keys = {}, |
| 189 | + Hash $keyrings = {}, |
| 190 | + Hash $ppas = {}, |
| 191 | + Hash $pins = {}, |
| 192 | + Hash $settings = {}, |
| 193 | + Boolean $manage_auth_conf = true, |
| 194 | + Array[Apt::Auth_conf_entry] $auth_conf_entries = [], |
| 195 | + String $auth_conf_owner = '_apt', |
| 196 | + String $root = '/etc/apt', |
| 197 | + String $sources_list = "${root}/sources.list", |
| 198 | + String $sources_list_d = "${root}/sources.list.d", |
| 199 | + String $conf_d = "${root}/apt.conf.d", |
| 200 | + String $preferences = "${root}/preferences", |
| 201 | + String $preferences_d = "${root}/preferences.d", |
| 202 | + String $apt_conf_d = "${root}/apt.conf.d", |
| 203 | + Hash $config_files = { |
| 204 | + 'conf' => { |
| 205 | + 'path' => $conf_d, |
| 206 | + 'ext' => '', |
| 207 | + }, |
| 208 | + 'pref' => { |
| 209 | + 'path' => $preferences_d, |
| 210 | + 'ext' => '.pref', |
| 211 | + }, |
| 212 | + 'list' => { |
| 213 | + 'path' => $sources_list_d, |
| 214 | + 'ext' => '.list', |
| 215 | + }, |
| 216 | + }, |
| 217 | + Boolean $sources_list_force = false, |
184 | 218 | Hash $source_key_defaults = {
|
185 | 219 | 'server' => $keyserver,
|
186 | 220 | 'options' => undef,
|
187 | 221 | 'content' => undef,
|
188 | 222 | 'source' => undef,
|
189 |
| - } |
190 |
| - |
191 |
| -) inherits apt::params { |
| 223 | + }, |
| 224 | +) { |
192 | 225 | if $facts['os']['family'] != 'Debian' {
|
193 | 226 | fail('This module only works on Debian or derivatives like Ubuntu')
|
194 | 227 | }
|
|
342 | 375 | notify => Class['apt::update'],
|
343 | 376 | }
|
344 | 377 |
|
345 |
| - if $confs { |
346 |
| - create_resources('apt::conf', $confs) |
| 378 | + $confs.each |$key, $value| { |
| 379 | + apt::conf { $key: |
| 380 | + * => $value, |
| 381 | + } |
347 | 382 | }
|
348 |
| - # manage sources if present |
349 |
| - if $sources { |
350 |
| - create_resources('apt::source', $sources) |
| 383 | + |
| 384 | + $sources.each |$key, $value| { |
| 385 | + apt::source { $key: |
| 386 | + * => $value, |
| 387 | + } |
351 | 388 | }
|
352 |
| - # manage keys if present |
353 |
| - if $keys { |
354 |
| - create_resources('apt::key', $keys) |
| 389 | + |
| 390 | + $keys.each |$key, $value| { |
| 391 | + apt::key { $key: |
| 392 | + * => $value, |
| 393 | + } |
355 | 394 | }
|
356 |
| - # manage keyrings if present |
| 395 | + |
357 | 396 | $keyrings.each |$key, $data| {
|
358 | 397 | apt::keyring { $key:
|
359 | 398 | * => $data,
|
360 | 399 | }
|
361 | 400 | }
|
362 |
| - # manage ppas if present |
363 |
| - if $ppas { |
364 |
| - create_resources('apt::ppa', $ppas) |
| 401 | + |
| 402 | + $ppas.each |$key, $value| { |
| 403 | + apt::ppa { $key: |
| 404 | + * => $value, |
| 405 | + } |
365 | 406 | }
|
366 |
| - # manage settings if present |
367 |
| - if $settings { |
368 |
| - create_resources('apt::setting', $settings) |
| 407 | + |
| 408 | + $settings.each |$key, $value| { |
| 409 | + apt::setting { $key: |
| 410 | + * => $value, |
| 411 | + } |
369 | 412 | }
|
370 | 413 |
|
371 | 414 | if $manage_auth_conf {
|
|
390 | 433 | }
|
391 | 434 | }
|
392 | 435 |
|
393 |
| - # manage pins if present |
394 |
| - if $pins { |
395 |
| - create_resources('apt::pin', $pins) |
| 436 | + $pins.each |$key, $value| { |
| 437 | + apt::pin { $key: |
| 438 | + * => $value, |
| 439 | + } |
396 | 440 | }
|
397 | 441 |
|
398 | 442 | case $facts['os']['name'] {
|
|
0 commit comments