From d65e1573a9f421d562eef6a11cbde99700036011 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 6 Oct 2010 11:16:44 +0200 Subject: Add a few useful functions. --- lib/puppet/parser/functions/nextcodename.rb | 10 ++++++++++ lib/puppet/parser/functions/nextrelease.rb | 10 ++++++++++ lib/puppet/parser/functions/release.rb | 11 +++++++++++ 3 files changed, 31 insertions(+) create mode 100644 lib/puppet/parser/functions/nextcodename.rb create mode 100644 lib/puppet/parser/functions/nextrelease.rb create mode 100644 lib/puppet/parser/functions/release.rb (limited to 'lib/puppet/parser/functions') diff --git a/lib/puppet/parser/functions/nextcodename.rb b/lib/puppet/parser/functions/nextcodename.rb new file mode 100644 index 0000000..3dd592b --- /dev/null +++ b/lib/puppet/parser/functions/nextcodename.rb @@ -0,0 +1,10 @@ +module Puppet::Parser::Functions + newfunction(:debian_nextcodename, :type => :rvalue) do |args| + case #{args[0]} { + etch: { 'lenny' } + lenny: { 'squeeze' } + squeeze: { 'sid' } + sid: { 'experimental' } + } + end +end diff --git a/lib/puppet/parser/functions/nextrelease.rb b/lib/puppet/parser/functions/nextrelease.rb new file mode 100644 index 0000000..4449121 --- /dev/null +++ b/lib/puppet/parser/functions/nextrelease.rb @@ -0,0 +1,10 @@ +module Puppet::Parser::Functions + newfunction(:debian_nextrelease, :type => :rvalue) do |args| + case #{args[0]} { + oldstable: { 'stable' } + stable: { 'testing' } + testing: { 'unstable' } + unstable: { 'experimental' } + } + end +end diff --git a/lib/puppet/parser/functions/release.rb b/lib/puppet/parser/functions/release.rb new file mode 100644 index 0000000..ef30484 --- /dev/null +++ b/lib/puppet/parser/functions/release.rb @@ -0,0 +1,11 @@ +module Puppet::Parser::Functions + newfunction(:debian_release, :type => :rvalue) do |args| + case #{args[0]} { + etch: { 'oldstable' } + lenny: { 'stable' } + squeeze: { 'testing' } + sid: { 'unstable' } + experimental: { 'experimental' } + } + end +end -- cgit v1.2.3 From 5326c54b817d6d86c1322dd1b923d1345460a721 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sat, 9 Oct 2010 21:18:10 +0200 Subject: Rename function file so that puppet hopefully finds it. --- lib/puppet/parser/functions/debian_release.rb | 11 +++++++++++ lib/puppet/parser/functions/release.rb | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 lib/puppet/parser/functions/debian_release.rb delete mode 100644 lib/puppet/parser/functions/release.rb (limited to 'lib/puppet/parser/functions') diff --git a/lib/puppet/parser/functions/debian_release.rb b/lib/puppet/parser/functions/debian_release.rb new file mode 100644 index 0000000..ef30484 --- /dev/null +++ b/lib/puppet/parser/functions/debian_release.rb @@ -0,0 +1,11 @@ +module Puppet::Parser::Functions + newfunction(:debian_release, :type => :rvalue) do |args| + case #{args[0]} { + etch: { 'oldstable' } + lenny: { 'stable' } + squeeze: { 'testing' } + sid: { 'unstable' } + experimental: { 'experimental' } + } + end +end diff --git a/lib/puppet/parser/functions/release.rb b/lib/puppet/parser/functions/release.rb deleted file mode 100644 index ef30484..0000000 --- a/lib/puppet/parser/functions/release.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:debian_release, :type => :rvalue) do |args| - case #{args[0]} { - etch: { 'oldstable' } - lenny: { 'stable' } - squeeze: { 'testing' } - sid: { 'unstable' } - experimental: { 'experimental' } - } - end -end -- cgit v1.2.3 From d50104ce10d7709c9c21f475eb6241136f937ad8 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 10 Oct 2010 11:00:18 +0200 Subject: Fix functions declaration and filenames. --- lib/puppet/parser/functions/debian_nextcodename.rb | 11 +++++++++++ lib/puppet/parser/functions/debian_nextrelease.rb | 11 +++++++++++ lib/puppet/parser/functions/debian_release.rb | 15 ++++++++------- lib/puppet/parser/functions/nextcodename.rb | 10 ---------- lib/puppet/parser/functions/nextrelease.rb | 10 ---------- 5 files changed, 30 insertions(+), 27 deletions(-) create mode 100644 lib/puppet/parser/functions/debian_nextcodename.rb create mode 100644 lib/puppet/parser/functions/debian_nextrelease.rb delete mode 100644 lib/puppet/parser/functions/nextcodename.rb delete mode 100644 lib/puppet/parser/functions/nextrelease.rb (limited to 'lib/puppet/parser/functions') diff --git a/lib/puppet/parser/functions/debian_nextcodename.rb b/lib/puppet/parser/functions/debian_nextcodename.rb new file mode 100644 index 0000000..37322a2 --- /dev/null +++ b/lib/puppet/parser/functions/debian_nextcodename.rb @@ -0,0 +1,11 @@ +module Puppet::Parser::Functions + newfunction(:debian_nextcodename, :type => :rvalue) do |args| + result = case #{args[0]} + when 'etch' then 'lenny' + when 'lenny' then 'squeeze' + when 'squeeze' then 'sid' + when 'sid' then 'experimental' + end + return result + end +end diff --git a/lib/puppet/parser/functions/debian_nextrelease.rb b/lib/puppet/parser/functions/debian_nextrelease.rb new file mode 100644 index 0000000..62e3234 --- /dev/null +++ b/lib/puppet/parser/functions/debian_nextrelease.rb @@ -0,0 +1,11 @@ +module Puppet::Parser::Functions + newfunction(:debian_nextrelease, :type => :rvalue) do |args| + result = case #{args[0]} + when 'oldstable' then 'stable' + when 'stable' then 'testing' + when 'testing' then 'unstable' + when 'unstable' then 'experimental' + end + return result + end +end diff --git a/lib/puppet/parser/functions/debian_release.rb b/lib/puppet/parser/functions/debian_release.rb index ef30484..ec46601 100644 --- a/lib/puppet/parser/functions/debian_release.rb +++ b/lib/puppet/parser/functions/debian_release.rb @@ -1,11 +1,12 @@ module Puppet::Parser::Functions newfunction(:debian_release, :type => :rvalue) do |args| - case #{args[0]} { - etch: { 'oldstable' } - lenny: { 'stable' } - squeeze: { 'testing' } - sid: { 'unstable' } - experimental: { 'experimental' } - } + result = case #{args[0]} + when 'etch' then 'oldstable' + when 'lenny' then 'stable' + when 'squeeze' then 'testing' + when 'sid' then 'unstable' + when 'experimental' then 'experimental' + end + return result end end diff --git a/lib/puppet/parser/functions/nextcodename.rb b/lib/puppet/parser/functions/nextcodename.rb deleted file mode 100644 index 3dd592b..0000000 --- a/lib/puppet/parser/functions/nextcodename.rb +++ /dev/null @@ -1,10 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:debian_nextcodename, :type => :rvalue) do |args| - case #{args[0]} { - etch: { 'lenny' } - lenny: { 'squeeze' } - squeeze: { 'sid' } - sid: { 'experimental' } - } - end -end diff --git a/lib/puppet/parser/functions/nextrelease.rb b/lib/puppet/parser/functions/nextrelease.rb deleted file mode 100644 index 4449121..0000000 --- a/lib/puppet/parser/functions/nextrelease.rb +++ /dev/null @@ -1,10 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:debian_nextrelease, :type => :rvalue) do |args| - case #{args[0]} { - oldstable: { 'stable' } - stable: { 'testing' } - testing: { 'unstable' } - unstable: { 'experimental' } - } - end -end -- cgit v1.2.3 From b4e24ecc0699687adec30bd38d78b34423eda1a1 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 10 Oct 2010 12:05:26 +0200 Subject: Fix functions return values. --- lib/puppet/parser/functions/debian_nextcodename.rb | 12 ++++++------ lib/puppet/parser/functions/debian_nextrelease.rb | 4 ++-- lib/puppet/parser/functions/debian_release.rb | 5 +++-- 3 files changed, 11 insertions(+), 10 deletions(-) (limited to 'lib/puppet/parser/functions') diff --git a/lib/puppet/parser/functions/debian_nextcodename.rb b/lib/puppet/parser/functions/debian_nextcodename.rb index 37322a2..6bc4b6b 100644 --- a/lib/puppet/parser/functions/debian_nextcodename.rb +++ b/lib/puppet/parser/functions/debian_nextcodename.rb @@ -1,11 +1,11 @@ module Puppet::Parser::Functions newfunction(:debian_nextcodename, :type => :rvalue) do |args| - result = case #{args[0]} - when 'etch' then 'lenny' - when 'lenny' then 'squeeze' - when 'squeeze' then 'sid' - when 'sid' then 'experimental' + case args[0] + when "etch" then "lenny" + when "lenny" then "squeeze" + when "squeeze" then "sid" + when "sid" then "experimental" + else "sid" end - return result end end diff --git a/lib/puppet/parser/functions/debian_nextrelease.rb b/lib/puppet/parser/functions/debian_nextrelease.rb index 62e3234..76c3e0d 100644 --- a/lib/puppet/parser/functions/debian_nextrelease.rb +++ b/lib/puppet/parser/functions/debian_nextrelease.rb @@ -1,11 +1,11 @@ module Puppet::Parser::Functions newfunction(:debian_nextrelease, :type => :rvalue) do |args| - result = case #{args[0]} + case args[0] when 'oldstable' then 'stable' when 'stable' then 'testing' when 'testing' then 'unstable' when 'unstable' then 'experimental' + else 'unstable' end - return result end end diff --git a/lib/puppet/parser/functions/debian_release.rb b/lib/puppet/parser/functions/debian_release.rb index ec46601..64feb66 100644 --- a/lib/puppet/parser/functions/debian_release.rb +++ b/lib/puppet/parser/functions/debian_release.rb @@ -1,12 +1,13 @@ module Puppet::Parser::Functions newfunction(:debian_release, :type => :rvalue) do |args| - result = case #{args[0]} + case args[0] when 'etch' then 'oldstable' when 'lenny' then 'stable' when 'squeeze' then 'testing' + when 'wheezy' then 'testing' when 'sid' then 'unstable' when 'experimental' then 'experimental' + else 'testing' end - return result end end -- cgit v1.2.3 From 4103a2705498b4e6d371af5582df74c93f6e7e2d Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 12 Dec 2010 09:43:40 +0100 Subject: Additionally use version number in Lenny default pinning. Lenny's APT does not support pinning like this: Pin: release o=Debian,n=<%= codename %> We therefore switched (in commit ef2ebdffd) to: Pin: release o=Debian,a=<%= release %> With such a pinning setup, when Squeeze is released, systems using this module with $apt_use_next_release set to true would immediately switch to prefer packages from Squeeze. If an automated upgrade process is setup, they would be automatically upgraded to Squeeze. This does not sound safe to me, so let's use the release version number as an additional selection criterion to prevent upgrades to Squeeze to happen behind our back: Pin: release o=Debian,a=<%= release %>,v=<%= release_version %>* Note that the trailing '*' is intentional and necessary to match stable point-releases. --- lib/puppet/parser/functions/debian_release_version.rb | 9 +++++++++ manifests/init.pp | 3 ++- templates/Debian/preferences_lenny.erb | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 lib/puppet/parser/functions/debian_release_version.rb (limited to 'lib/puppet/parser/functions') diff --git a/lib/puppet/parser/functions/debian_release_version.rb b/lib/puppet/parser/functions/debian_release_version.rb new file mode 100644 index 0000000..4b135d0 --- /dev/null +++ b/lib/puppet/parser/functions/debian_release_version.rb @@ -0,0 +1,9 @@ +module Puppet::Parser::Functions + newfunction(:debian_release_version, :type => :rvalue) do |args| + case args[0] + when 'etch' then '4.0' + when 'lenny' then '5.0' + else '' + end + end +end diff --git a/manifests/init.pp b/manifests/init.pp index 2d46ad4..7fa811d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -62,7 +62,7 @@ class apt { include lsb - # init $release, $next_release, $codename, $next_codename + # init $release, $next_release, $codename, $next_codename, $release_version case $lsbdistcodename { '': { $codename = $lsbdistcodename @@ -73,6 +73,7 @@ class apt { $release = debian_release($codename) } } + $release_version = debian_release_version($codename) $next_codename = debian_nextcodename($codename) $next_release = debian_nextrelease($release) diff --git a/templates/Debian/preferences_lenny.erb b/templates/Debian/preferences_lenny.erb index be8ecd8..dda2d7a 100644 --- a/templates/Debian/preferences_lenny.erb +++ b/templates/Debian/preferences_lenny.erb @@ -1,6 +1,6 @@ Explanation: Debian <%= codename %> Package: * -Pin: release o=Debian,a=<%= release %> +Pin: release o=Debian,a=<%= release %>,v=<%= release_version %>* Pin-Priority: 990 Explanation: Debian backports -- cgit v1.2.3 From f362f059956d745037425eb5f8c27ce48c14632e Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 6 Feb 2011 08:56:54 +0100 Subject: Update debian_release function since Squeeze has been released. --- lib/puppet/parser/functions/debian_release.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/puppet/parser/functions') diff --git a/lib/puppet/parser/functions/debian_release.rb b/lib/puppet/parser/functions/debian_release.rb index 64feb66..857edf3 100644 --- a/lib/puppet/parser/functions/debian_release.rb +++ b/lib/puppet/parser/functions/debian_release.rb @@ -1,9 +1,8 @@ module Puppet::Parser::Functions newfunction(:debian_release, :type => :rvalue) do |args| case args[0] - when 'etch' then 'oldstable' - when 'lenny' then 'stable' - when 'squeeze' then 'testing' + when 'lenny' then 'oldstable' + when 'squeeze' then 'stable' when 'wheezy' then 'testing' when 'sid' then 'unstable' when 'experimental' then 'experimental' -- cgit v1.2.3 From e32f4275a6ec3c4cb531f1ec1816479d6d2dd36c Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 7 Feb 2011 11:27:54 +0100 Subject: debian_release_version: add Squeeze's version number. --- lib/puppet/parser/functions/debian_release_version.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/puppet/parser/functions') diff --git a/lib/puppet/parser/functions/debian_release_version.rb b/lib/puppet/parser/functions/debian_release_version.rb index 4b135d0..ff58f72 100644 --- a/lib/puppet/parser/functions/debian_release_version.rb +++ b/lib/puppet/parser/functions/debian_release_version.rb @@ -3,6 +3,7 @@ module Puppet::Parser::Functions case args[0] when 'etch' then '4.0' when 'lenny' then '5.0' + when 'squeeze' then '6.0' else '' end end -- cgit v1.2.3 From f11e821f0ad7e52be19163b62f18930c90fffed5 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 7 Feb 2011 11:28:29 +0100 Subject: debian_nextcodename: take into account Squeeze was released. --- lib/puppet/parser/functions/debian_nextcodename.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/puppet/parser/functions') diff --git a/lib/puppet/parser/functions/debian_nextcodename.rb b/lib/puppet/parser/functions/debian_nextcodename.rb index 6bc4b6b..f57dd2a 100644 --- a/lib/puppet/parser/functions/debian_nextcodename.rb +++ b/lib/puppet/parser/functions/debian_nextcodename.rb @@ -3,7 +3,8 @@ module Puppet::Parser::Functions case args[0] when "etch" then "lenny" when "lenny" then "squeeze" - when "squeeze" then "sid" + when "squeeze" then "wheezy" + when "wheezy" then "sid" when "sid" then "experimental" else "sid" end -- cgit v1.2.3