true => "# Repos managed by puppet.\n",
}
- $preferences_content = $purge_preferences ? {
- false => undef,
- true => "Explanation: Preferences managed by Puppet\n
-Explanation: We need a bogus package line because of Debian Bug #732746\n
-Package: bogus-package\n",
- }
-
if $always_apt_update == true {
Exec <| title=='apt_update' |> {
refreshonly => false,
notify => Exec['apt_update'],
}
- file { 'apt-preferences':
- ensure => present,
- path => "${root}/preferences",
- owner => root,
- group => root,
- mode => '0644',
- content => $preferences_content,
+ if $purge_preferences {
+ file { 'apt-preferences':
+ ensure => absent,
+ path => "${root}/preferences",
+ }
}
file { 'preferences.d':
default: { fail('Valid values for disable_keys are true or false') }
}
- $proxy_set = $proxy_host ? {
- undef => absent,
- default => present
+ case $proxy_host {
+ false, '', undef: {
+ file { '01proxy':
+ ensure => absent,
+ path => "${apt_conf_d}/01proxy",
+ notify => Exec['apt_update'],
+ }
+ }
+ default: {
+ file { '01proxy':
+ ensure => present,
+ path => "${apt_conf_d}/01proxy",
+ content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";\n",
+ notify => Exec['apt_update'],
+ mode => '0644',
+ owner => root,
+ group => root,
+ }
+ }
}
- file { '01proxy':
- ensure => $proxy_set,
- path => "${apt_conf_d}/01proxy",
- content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";\n",
- notify => Exec['apt_update'],
- mode => '0644',
- owner => root,
- group => root,
- }
-
file { 'old-proxy-file':
ensure => absent,
path => "${apt_conf_d}/proxy",