diff options
author | Louis-Philippe Véronneau <pollito@riseup.net> | 2017-02-24 17:08:12 -0500 |
---|---|---|
committer | Louis-Philippe Véronneau <pollito@riseup.net> | 2017-02-24 17:08:12 -0500 |
commit | e6b07002d6b53b45012d93a33296b7b7e32f8e92 (patch) | |
tree | 56f4168fde3231c02a8d0dcdbf5f534a97143790 | |
parent | 3f0a363088c64c905a3fe7f6369d28b770cdf481 (diff) |
remove preferences.d files when not using them
-rw-r--r-- | manifests/config.pp | 1 | ||||
-rw-r--r-- | manifests/preferences.pp | 37 |
2 files changed, 23 insertions, 15 deletions
diff --git a/manifests/config.pp b/manifests/config.pp index f50d4bc..50a8ebd 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -3,7 +3,6 @@ class apt::config { exec { 'update_apt': command => '/usr/bin/apt-get update', require => [ File['/etc/apt/apt.conf.d', - '/etc/apt/preferences.d/stable', '/etc/apt/sources.list'] ], refreshonly => true; } diff --git a/manifests/preferences.pp b/manifests/preferences.pp index 548098f..a1e78ee 100644 --- a/manifests/preferences.pp +++ b/manifests/preferences.pp @@ -2,13 +2,19 @@ class apt::preferences { if ($apt::manage_preferences == true) and ($apt::custom_preferences != undef) { - file { '/etc/apt/preferences.d/custom': - ensure => present, - alias => 'apt_config', - # only update together - content => $custom_preferences, - require => File['/etc/apt/sources.list'], - owner => root, group => 0, mode => '0644'; + file { + '/etc/apt/preferences.d/custom': + ensure => present, + alias => 'apt_config', + content => template(${apt::custom_preferences}), + require => File['/etc/apt/sources.list'], + owner => root, group => 0, mode => '0644'; + + [ '/etc/apt/preferences.d/stable', + '/etc/apt/preferences.d/volatile', + '/etc/apt/preferences.d/lts', + '/etc/apt/preferences.d/nextcodename' ]: + ensure => absent; } } @@ -16,13 +22,16 @@ class apt::preferences { if $::operatingsystem == "Debian" { - file { '/etc/apt/preferences.d/stable': - ensure => present, - alias => 'apt_config', - # only update together - content => template('apt/Debian/stable.erb'), - require => File['/etc/apt/sources.list'], - owner => root, group => 0, mode => '0644'; + file { + '/etc/apt/preferences.d/stable': + ensure => present, + alias => 'apt_config', + content => template('apt/Debian/stable.erb'), + require => File['/etc/apt/sources.list'], + owner => root, group => 0, mode => '0644'; + + '/etc/apt/preferences.d/custom': + ensure => absent; } if $apt::use_volatile { |