fix for $lsbdistcodename regression introduced by ac166366d7
What happened here was the $codename = $::lsbdistcodename was removed from init.pp and replaced with just $::lsbdistcodename whereever $codename was used. Then in the sources.list.erb and preferences files things were changed like this: <pre>+### Debian current: <%= codename = scope.lookupvar('::lsbdistcodename') %> ... -deb <%= debian_url %> <%= codename %> <%= repos %> ... +deb <%= debian_url=scope.lookupvar('apt::debian_url') %> <%= codename %> <%= repos=scope.lookupvar('apt::repos') %> </pre> This meant that the codename was always set to lsbdistcodename, and you because in newer puppet versions you cannot assign a value to a top-level facter variable, it is not possible to change this. Because we cannot change $lsbdistcodename, we have to fix this by allowing the user to pass a different, non-top-level scoped variable to the class as a parameter, which defaults to $::lsbdistcodename, so that upgrades can be triggered. This is documented in the README in an upgrade notice
This commit is contained in:
parent
460c1d54d1
commit
07a031f205
9 changed files with 61 additions and 45 deletions
28
README
28
README
|
@ -31,6 +31,17 @@ Ubuntu support is lagging behind but not absent either.
|
|||
|
||||
class { 'apt': debian_url => "http://localhost:9999/debian/", use_next_release => true }
|
||||
|
||||
previously, you could manually set $lsbdistcodename which would enable forced
|
||||
upgrades, but because this is a top-level facter variable, and newer puppet
|
||||
versions do not let you assign variables to other namespaces, this is no
|
||||
longer possible. However, there is a way to obtain this functionality, and
|
||||
that is to pass the 'codename' parameter to the apt class, which will change
|
||||
the sources.list and preferences files to be the codename you set, allowing
|
||||
you to trigger upgrades:
|
||||
|
||||
include apt::dist_upgrade
|
||||
class { 'apt': codename => 'wheezy', notify => Exec['apt_dist-upgrade'] }
|
||||
|
||||
* the apticron class has been moved to a parameterized class. if you were
|
||||
including this class before, you will need to move to instantiating the
|
||||
class instead. For example, if you had the following in your manifests:
|
||||
|
@ -106,13 +117,6 @@ site_apt/files/some.host.com/03clean_vserver)
|
|||
Variables
|
||||
=========
|
||||
|
||||
$::lsbdistcodename
|
||||
----------------
|
||||
|
||||
Contains the codename ("etch", "lenny", ...) of the client's
|
||||
release. While these values come from lsb-release by default, this
|
||||
value can be set manually too, e.g. to enable forced upgrades.
|
||||
|
||||
$custom_sources_list
|
||||
--------------------
|
||||
|
||||
|
@ -219,6 +223,16 @@ apt/preferences file to be absent:
|
|||
|
||||
class { 'apt': custom_preferences => false }
|
||||
|
||||
codename
|
||||
--------
|
||||
|
||||
Contains the codename ("squeeze", "wheezy", ...) of the client's release. While
|
||||
these values come from lsb-release by default, this parameter can be set
|
||||
manually, e.g. to enable forced upgrades. For example:
|
||||
|
||||
include apt::dist_upgrade
|
||||
class { 'apt': codename => 'wheezy', notify => Exec['apt_dist-upgrade'] }
|
||||
|
||||
|
||||
apt::apticron
|
||||
-------------
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
# See LICENSE for the full license granted to you.
|
||||
|
||||
class apt(
|
||||
$codename = '',
|
||||
$use_volatile = false,
|
||||
$include_src = false,
|
||||
$use_next_release = false,
|
||||
|
@ -38,16 +39,17 @@ class apt(
|
|||
include lsb
|
||||
|
||||
# init $release, $next_release, $codename, $next_codename, $release_version
|
||||
case $::lsbdistcodename {
|
||||
case $codename {
|
||||
'': {
|
||||
$codename = $::lsbdistcodename
|
||||
$release = $::lsbdistrelease
|
||||
}
|
||||
default: {
|
||||
$release = debian_release($::lsbdistcodename)
|
||||
$release = debian_release($codename)
|
||||
}
|
||||
}
|
||||
$release_version = debian_release_version($::lsbdistcodename)
|
||||
$next_codename = debian_nextcodename($::lsbdistcodename)
|
||||
$release_version = debian_release_version($codename)
|
||||
$next_codename = debian_nextcodename($codename)
|
||||
$next_release = debian_nextrelease($release)
|
||||
|
||||
file {
|
||||
|
|
|
@ -3,8 +3,8 @@ class apt::preferences {
|
|||
concat::fragment{"apt_preferences_header":
|
||||
content => $apt::custom_preferences ? {
|
||||
'' => $::operatingsystem ? {
|
||||
'debian' => template("apt/${::operatingsystem}/preferences_${::lsbdistcodename}.erb"),
|
||||
'ubuntu' => template("apt/${::operatingsystem}/preferences_${::lsbdistcodename}.erb"),
|
||||
'debian' => template("apt/${::operatingsystem}/preferences_${apt::codename}.erb"),
|
||||
'ubuntu' => template("apt/${::operatingsystem}/preferences_${apt::codename}.erb"),
|
||||
},
|
||||
default => $custom_preferences
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Explanation: Debian <%= scope.lookupvar('::lsbdistcodename') %>
|
||||
Explanation: Debian <%= codename=scope.lookupvar('apt::codename') %>
|
||||
Package: *
|
||||
Pin: release o=Debian,a=<%= scope.lookupvar('apt::release') %>,v=<%= scope.lookupvar('apt::release_version') %>*
|
||||
Pin-Priority: 990
|
||||
|
@ -8,9 +8,9 @@ Package: *
|
|||
Pin: origin backports.debian.org
|
||||
Pin-Priority: 200
|
||||
|
||||
Explanation: Debian <%= scope.lookupvar('apt::next_release') %>
|
||||
Explanation: Debian <%= next_release=scope.lookupvar('apt::next_release') %>
|
||||
Package: *
|
||||
Pin: release o=Debian,a=<%= scope.lookupvar('apt::next_release') %>
|
||||
Pin: release o=Debian,a=<%= next_release %>
|
||||
Pin-Priority: 2
|
||||
|
||||
Explanation: Debian sid
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
Explanation: Debian <%= scope.lookupvar('::lsbdistcodename') %>
|
||||
Explanation: Debian <%= codename=scope.lookupvar('apt::codename') %>
|
||||
Package: *
|
||||
Pin: release o=Debian,n=<%= scope.lookupvar('::lsbdistcodename') %>
|
||||
Pin: release o=Debian,n=<%= codename %>
|
||||
Pin-Priority: 990
|
||||
|
||||
Explanation: Debian <%= scope.lookupvar('::lsbdistcodename') %>-updates
|
||||
Explanation: Debian <%= codename %>-updates
|
||||
Package: *
|
||||
Pin: release o=Debian,n=<%= scope.lookupvar('::lsbdistcodename') %>-updates
|
||||
Pin: release o=Debian,n=<%= codename %>-updates
|
||||
Pin-Priority: 990
|
||||
|
||||
Explanation: Debian <%= scope.lookupvar('apt::next_codename') %>
|
||||
Explanation: Debian <%= next_codename=scope.lookupvar('apt::next_codename') %>
|
||||
Package: *
|
||||
Pin: release o=Debian,n=<%= scope.lookupvar('apt::next_codename') %>
|
||||
Pin: release o=Debian,n=<%= next_codename %>
|
||||
Pin-Priority: 2
|
||||
|
||||
Explanation: Debian sid
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
Explanation: Debian <%= scope.lookupvar('::lsbdistcodename') %>
|
||||
Explanation: Debian <%= codename=scope.lookupvar('apt::codename') %>
|
||||
Package: *
|
||||
Pin: release o=Debian,n=<%= scope.lookupvar('::lsbdistcodename') %>
|
||||
Pin: release o=Debian,n=<%= codename %>
|
||||
Pin-Priority: 990
|
||||
|
||||
Explanation: Debian <%= scope.lookupvar('::lsbdistcodename') %>-updates
|
||||
Explanation: Debian <%= codename %>-updates
|
||||
Package: *
|
||||
Pin: release o=Debian,n=<%= scope.lookupvar('::lsbdistcodename') %>-updates
|
||||
Pin: release o=Debian,n=<%= codename %>-updates
|
||||
Pin-Priority: 990
|
||||
|
||||
Explanation: Debian sid
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This file is managed by puppet
|
||||
# all local modifications will be overwritten
|
||||
|
||||
### Debian current: <%= codename = scope.lookupvar('::lsbdistcodename') %>
|
||||
### Debian current: <%= codename=scope.lookupvar('apt::codename') %>
|
||||
|
||||
# basic
|
||||
deb <%= debian_url=scope.lookupvar('apt::debian_url') %> <%= codename %> <%= lrepos=scope.lookupvar('apt::real_repos') %>
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
Explanation: Ubuntu <%= scope.lookupvar('::lsbdistcodename') %> security
|
||||
Explanation: Ubuntu <%= codename=scope.lookupvar('apt::codename') %> security
|
||||
Package: *
|
||||
Pin: release o=Ubuntu,a=<%= scope.lookupvar('::lsbdistcodename') %>-security
|
||||
Pin: release o=Ubuntu,a=<%= codename %>-security
|
||||
Pin-Priority: 990
|
||||
|
||||
Explanation: Ubuntu <%= scope.lookupvar('::lsbdistcodename') %> updates
|
||||
Explanation: Ubuntu <%= codename %> updates
|
||||
Package: *
|
||||
Pin: release o=Ubuntu,a=<%= scope.lookupvar('::lsbdistcodename') %>-updates
|
||||
Pin: release o=Ubuntu,a=<%= codename %>-updates
|
||||
Pin-Priority: 980
|
||||
|
||||
Explanation: Ubuntu <%= scope.lookupvar('::lsbdistcodename') %>
|
||||
Explanation: Ubuntu <%= codename %>
|
||||
Package: *
|
||||
Pin: release o=Ubuntu,a=<%= scope.lookupvar('::lsbdistcodename') %>
|
||||
Pin: release o=Ubuntu,a=<%= codename %>
|
||||
Pin-Priority: 970
|
||||
|
||||
Explanation: Ubuntu backports
|
||||
Package: *
|
||||
Pin: release a=<%= scope.lookupvar('::lsbdistcodename') %>-backports
|
||||
Pin: release a=<%= codename %>-backports
|
||||
Pin-Priority: 200
|
||||
|
||||
Explanation: Ubuntu <%= scope.lookupvar('apt::next_release') %>
|
||||
Explanation: Ubuntu <%= next_release=scope.lookupvar('apt::next_release') %>
|
||||
Package: *
|
||||
Pin: release o=Ubuntu,a=<%= scope.lookupvar('apt::next_release') %>
|
||||
Pin: release o=Ubuntu,a=<%= next_release %>
|
||||
Pin-Priority: 2
|
||||
|
||||
Explanation: Ubuntu fallback
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
# This file is managed by puppet
|
||||
# all local modifications will be overwritten
|
||||
|
||||
# basic <%= lsbdistcodename=scope.lookupvar('::lsbdistcodename') %>
|
||||
deb <%= ubuntu_url=scope.lookupvar('apt::ubuntu_url') %> <%= lsbdistcodename %> <%= lrepos=scope.lookupvar('apt::real_repos') %>
|
||||
# basic <%= codename=scope.lookupvar('apt::codename') %>
|
||||
deb <%= ubuntu_url=scope.lookupvar('apt::ubuntu_url') %> <%= codename %> <%= lrepos=scope.lookupvar('apt::real_repos') %>
|
||||
<% if include_src=scope.lookupvar('apt::include_src') -%>
|
||||
deb-src <%= ubuntu_url %> <%= lsbdistcodename %> <%= lrepos %>
|
||||
deb-src <%= ubuntu_url %> <%= codename %> <%= lrepos %>
|
||||
<% end -%>
|
||||
|
||||
# updates
|
||||
deb <%= ubuntu_url %> <%= lsbdistcodename %>-updates <%= lrepos %>
|
||||
deb <%= ubuntu_url %> <%= codename %>-updates <%= lrepos %>
|
||||
<% if include_src -%>
|
||||
deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-updates <%= lrepos %>
|
||||
deb-src <%= ubuntu_url %> <%= codename %>-updates <%= lrepos %>
|
||||
<% end -%>
|
||||
|
||||
# security suppport
|
||||
deb <%= ubuntu_url %> <%= lsbdistcodename %>-security <%= lrepos %>
|
||||
deb <%= ubuntu_url %> <%= codename %>-security <%= lrepos %>
|
||||
<% if include_src -%>
|
||||
deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-security <%= lrepos %>
|
||||
deb-src <%= ubuntu_url %> <%= codename %>-security <%= lrepos %>
|
||||
<% end -%>
|
||||
|
||||
# backports
|
||||
deb <%= ubuntu_url %> <%= lsbdistcodename %>-backports main <%= lrepos %>
|
||||
deb <%= ubuntu_url %> <%= codename %>-backports main <%= lrepos %>
|
||||
<% if include_src -%>
|
||||
deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-backports <%= lrepos %>
|
||||
deb-src <%= ubuntu_url %> <%= codename %>-backports <%= lrepos %>
|
||||
<% end -%>
|
||||
|
|
Loading…
Reference in a new issue