summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2018-01-08 15:28:45 +0000
committerintrigeri <intrigeri@boum.org>2018-01-08 15:28:45 +0000
commit20495b7f7dd9b467a53a843d484f1726f0cbab85 (patch)
treee241fe6cc7903c4b300563e51463900f38a95ab2
parent9ae9f6f45c65e3a3b83cdad523510f7df579d598 (diff)
parent2fbab4798f4683f5b4e70887b8d33c2f1bc97f40 (diff)
Merge remote-tracking branch 'lelutin-gitlab/issue_22' (Closes #22)
-rw-r--r--files/Debian/preferences_fallback (renamed from templates/Debian/fallback.erb)0
-rw-r--r--manifests/preferences.pp159
-rw-r--r--templates/Debian/current_codename.erb (renamed from templates/Debian/stable.erb)0
-rw-r--r--templates/Debian/preferences.erb33
4 files changed, 92 insertions, 100 deletions
diff --git a/templates/Debian/fallback.erb b/files/Debian/preferences_fallback
index 1c75e83..1c75e83 100644
--- a/templates/Debian/fallback.erb
+++ b/files/Debian/preferences_fallback
diff --git a/manifests/preferences.pp b/manifests/preferences.pp
index ce28d37..0ec77cf 100644
--- a/manifests/preferences.pp
+++ b/manifests/preferences.pp
@@ -1,110 +1,135 @@
+# Configure basic pins for debian/Ubuntu codenames
+#
+# This all ensures that apt behaves as expected with regards to packages when
+# we have more sources than just the one for the current codenamed release.
+#
+# This class should not be included directly. It is automatically called in by
+# the 'apt' class. Thus you should use the apt class instead.
+#
class apt::preferences {
file { '/etc/apt/preferences':
- ensure => absent;
+ ensure => absent,
+ }
+ # Remove the file that we were previously deploying. It's now been renamed to
+ # current_codename
+ file { '/etc/apt/preferences.d/stable':
+ ensure => absent,
}
if ($apt::manage_preferences == true) and ($apt::custom_preferences != undef) {
-
- 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':
- ensure => absent;
-
- '/etc/apt/preferences.d/volatile':
- ensure => absent;
-
- '/etc/apt/preferences.d/lts':
- ensure => absent;
-
- '/etc/apt/preferences.d/nextcodename':
- ensure => absent;
+ file { '/etc/apt/preferences.d/custom':
+ ensure => present,
+ alias => 'apt_config',
+ content => template($apt::custom_preferences),
+ owner => 'root',
+ group => 0,
+ mode => '0644',
+ require => File['/etc/apt/sources.list'],
+ }
+ file { '/etc/apt/preferences.d/current_codename':
+ ensure => absent,
+ }
+ file { '/etc/apt/preferences.d/volatile':
+ ensure => absent,
+ }
+ file { '/etc/apt/preferences.d/lts':
+ ensure => absent,
+ }
+ file { '/etc/apt/preferences.d/nextcodename':
+ ensure => absent,
}
}
-
elsif $apt::manage_preferences == true {
- if $::operatingsystem == "Debian" {
-
- 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 $::operatingsystem == 'Debian' {
+ file { '/etc/apt/preferences.d/current_codename':
+ ensure => present,
+ alias => 'apt_config',
+ content => template('apt/Debian/current_codename.erb'),
+ owner => 'root',
+ group => 0,
+ mode => '0644',
+ require => File['/etc/apt/sources.list'],
+ }
+ # Cleanup for cases where users might switch from using
+ # custom_preferences to not using it anymore.
+ file { '/etc/apt/preferences.d/custom':
+ ensure => absent,
+ }
+ # This file ensures that all debian packages that don't have a
+ # preference file shouldn't be considered for auto-install or upgrade at
+ # all.
+ file { '/etc/apt/preferences.d/debian_fallback':
+ ensure => present,
+ source => 'puppet:///modules/apt/Debian/preferences_fallback',
+ owner => 'root',
+ group => 0,
+ mode => '0644',
+ require => File['/etc/apt/sources.list'],
}
if $apt::use_volatile {
-
file { '/etc/apt/preferences.d/volatile':
ensure => present,
content => template('apt/Debian/volatile.erb'),
+ owner => 'root',
+ group => 0,
+ mode => '0644',
require => File['/etc/apt/sources.list'],
- owner => root, group => 0, mode => '0644';
}
}
if $apt::use_lts {
-
file { '/etc/apt/preferences.d/lts':
ensure => present,
content => template('apt/Debian/lts.erb'),
+ owner => 'root',
+ group => 0,
+ mode => '0644',
require => File['/etc/apt/sources.list'],
- owner => root, group => 0, mode => '0644';
}
}
- if ($::debian_nextcodename) and ($::debian_nextcodename != "experimental") {
-
+ if ($::debian_nextcodename) and ($::debian_nextcodename != 'experimental') {
file { '/etc/apt/preferences.d/nextcodename':
ensure => present,
content => template('apt/Debian/nextcodename.erb'),
+ owner => 'root',
+ group => 0,
+ mode => '0644',
require => File['/etc/apt/sources.list'],
- owner => root, group => 0, mode => '0644';
}
}
}
-
- elsif $::operatingsystem == "Ubuntu" {
-
+ elsif $::operatingsystem == 'Ubuntu' {
file { '/etc/apt/preferences':
- ensure => present,
- alias => 'apt_config',
- # only update together
- content => template("apt/Ubuntu/preferences_${apt::codename}.erb"),
- require => File['/etc/apt/sources.list'],
- owner => root, group => 0, mode => '0644';
+ ensure => present,
+ alias => 'apt_config',
+ # only update together
+ content => template("apt/Ubuntu/preferences_${apt::codename}.erb"),
+ owner => 'root',
+ group => 0,
+ mode => '0644',
+ require => File['/etc/apt/sources.list'],
}
}
}
-
elsif $apt::manage_preferences == false {
-
- file {
- '/etc/apt/preferences.d/custom':
- ensure => absent;
-
- '/etc/apt/preferences.d/stable':
- ensure => absent;
-
- '/etc/apt/preferences.d/volatile':
- ensure => absent;
-
- '/etc/apt/preferences.d/lts':
- ensure => absent;
-
- '/etc/apt/preferences.d/nextcodename':
- ensure => absent;
+ file { '/etc/apt/preferences.d/custom':
+ ensure => absent,
+ }
+ file { '/etc/apt/preferences.d/current_codename':
+ ensure => absent,
+ }
+ file { '/etc/apt/preferences.d/volatile':
+ ensure => absent,
+ }
+ file { '/etc/apt/preferences.d/lts':
+ ensure => absent,
+ }
+ file { '/etc/apt/preferences.d/nextcodename':
+ ensure => absent,
}
}
}
diff --git a/templates/Debian/stable.erb b/templates/Debian/current_codename.erb
index be05e51..be05e51 100644
--- a/templates/Debian/stable.erb
+++ b/templates/Debian/current_codename.erb
diff --git a/templates/Debian/preferences.erb b/templates/Debian/preferences.erb
deleted file mode 100644
index 37cf80d..0000000
--- a/templates/Debian/preferences.erb
+++ /dev/null
@@ -1,33 +0,0 @@
-# This file is managed by puppet
-# all local modifications will be overwritten
-
-Explanation: Debian <%= codename=scope.lookupvar('::debian_codename') %>
-Package: *
-Pin: release o=Debian,n=<%= codename %>
-Pin-Priority: 990
-
-<% if use_volatile=scope.lookupvar('apt::use_volatile') -%>
-Explanation: Debian <%= codename %>-updates
-Package: *
-Pin: release o=Debian,n=<%= codename %>-updates
-Pin-Priority: 990
-<%- end -%>
-
-<% if (use_lts=scope.lookupvar('apt::use_lts')) && (scope.lookupvar('::debian_lts') == "true") -%>
-Explanation: Debian <%= codename %>-lts
-Package: *
-Pin: release o=Debian,n=<%= codename %>-lts
-Pin-Priority: 990
-<%- end -%>
-
-<% if (next_codename=scope.lookupvar('::debian_nextcodename')) && (next_codename != "experimental") -%>
-Explanation: Debian <%= next_codename %>
-Package: *
-Pin: release o=Debian,n=<%= next_codename %>
-Pin-Priority: 2
-<%- end -%>
-
-Explanation: Debian fallback
-Package: *
-Pin: release o=Debian
-Pin-Priority: -10