From d51e2af9d452731f63b2fe16391e9cd2ff9d640f Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 23 Jan 2013 23:10:40 +0100 Subject: Don't check for a package priority to be set when removing an APT preferences snippet. The problem I'm facing is that the sanity checks prevent one from using a simple: apt::preferences_snippet { "bla": ensure => absent } So, first set a default value for the `priority' parameter, so that it's not required anymore. Second, add a sanity check to error out when priority is not set, to get the safe old behaviour. Then, wrap all sanity checks about arguments within a "if $ensure == 'present'" block. --- manifests/preferences_snippet.pp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp index 0bff85c..5ae748b 100644 --- a/manifests/preferences_snippet.pp +++ b/manifests/preferences_snippet.pp @@ -1,5 +1,5 @@ define apt::preferences_snippet ( - $priority, + $priority = undef, $package = false, $ensure = 'present', $source = '', @@ -12,15 +12,21 @@ define apt::preferences_snippet ( default => $package, } - if $custom_preferences == false { - fail('Trying to define a preferences_snippet with $custom_preferences set to false.') - } + if $ensure == 'present' { + if $custom_preferences == false { + fail('Trying to define a preferences_snippet with $custom_preferences set to false.') + } - if !$pin and !$release { - fail('apt::preferences_snippet requires one of the \'pin\' or \'release\' argument to be set') - } - if $pin and $release { - fail('apt::preferences_snippet requires either a \'pin\' or \'release\' argument, not both') + if $priority == undef { + fail('apt::preferences_snippet requires the \'priority\' argument to be set') + } + + if !$pin and !$release { + fail('apt::preferences_snippet requires one of the \'pin\' or \'release\' argument to be set') + } + if $pin and $release { + fail('apt::preferences_snippet requires either a \'pin\' or \'release\' argument, not both') + } } file { "/etc/apt/preferences.d/${name}": -- cgit v1.2.3 From f0a107ffeecaf968a8abcd51220d5e42b4b36095 Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 5 Mar 2013 09:39:23 +0100 Subject: fix #4249: Ubuntu: wrong sources.list entries --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 020c1cc..5722c6a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -26,7 +26,7 @@ class apt( } 'ubuntu': { $real_repos = $repos ? { - '' => 'main restricted universe multiverse', + 'auto' => 'main restricted universe multiverse', default => $repos, } } -- cgit v1.2.3 From 5ec8ffb4ef1bdb6194d306f4e24b063b83c09982 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 20 Mar 2013 22:09:29 +0100 Subject: Move apt class parameters to a ::params class. This brings no behaviour change yet, but will allow to set class parameters' default value depending on system facts. --- manifests/init.pp | 26 +++++++++++++------------- manifests/params.pp | 14 ++++++++++++++ 2 files changed, 27 insertions(+), 13 deletions(-) create mode 100644 manifests/params.pp diff --git a/manifests/init.pp b/manifests/init.pp index 5722c6a..3f8e1c8 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -4,19 +4,19 @@ # See LICENSE for the full license granted to you. class apt( - $codename = $::lsbdistcodename, - $use_volatile = false, - $include_src = false, - $use_next_release = false, - $debian_url = 'http://http.debian.net/debian/', - $security_url = 'http://security.debian.org/', - $backports_url = 'http://backports.debian.org/debian-backports/', - $volatile_url = 'http://volatile.debian.org/debian-volatile/', - $ubuntu_url = 'http://archive.ubuntu.com/ubuntu', - $repos = 'auto', - $custom_preferences = '', - $disable_update = false -){ + $codename = $apt::params::codename, + $use_volatile = $apt::params::use_volatile, + $include_src = $apt::params::include_src, + $use_next_release = $apt::params::use_next_release, + $debian_url = $apt::params::debian_url, + $security_url = $apt::params::security_url, + $backports_url = $apt::params::backports_url, + $volatile_url = $apt::params::volatile_url, + $ubuntu_url = $apt::params::ubuntu_url, + $repos = $apt::params::repos, + $custom_preferences = $apt::params::custom_preferences, + $disable_update = $apt::params::disable_update +) inherits apt::params { case $::operatingsystem { 'debian': { $real_repos = $repos ? { diff --git a/manifests/params.pp b/manifests/params.pp new file mode 100644 index 0000000..f71570b --- /dev/null +++ b/manifests/params.pp @@ -0,0 +1,14 @@ +class apt::params () { + $codename = $::lsbdistcodename + $use_volatile = false + $include_src = false + $use_next_release = false + $debian_url = 'http://http.debian.net/debian/' + $security_url = 'http://security.debian.org/' + $backports_url = 'http://backports.debian.org/debian-backports/' + $volatile_url = 'http://volatile.debian.org/debian-volatile/' + $ubuntu_url = 'http://archive.ubuntu.com/ubuntu' + $repos = 'auto' + $custom_preferences = '' + $disable_update = false +} -- cgit v1.2.3 From 46c58b07bfd6d6d6ed4bc4139ed4fd14bfe8ada3 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 20 Mar 2013 22:11:46 +0100 Subject: Use the main Debian archive's URL as the default URL for backports on Wheezy. The backports are now fully integrated with the main archive. See: https://labs.riseup.net/code/issues/4270 https://lists.debian.org/debian-devel-announce/2013/03/msg00007.html --- manifests/params.pp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index f71570b..b210ff6 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -5,7 +5,10 @@ class apt::params () { $use_next_release = false $debian_url = 'http://http.debian.net/debian/' $security_url = 'http://security.debian.org/' - $backports_url = 'http://backports.debian.org/debian-backports/' + $backports_url = $::lsbdistcodename ? { + 'wheezy' => $debian_url, + default => 'http://backports.debian.org/debian-backports/', + } $volatile_url = 'http://volatile.debian.org/debian-volatile/' $ubuntu_url = 'http://archive.ubuntu.com/ubuntu' $repos = 'auto' -- cgit v1.2.3 From c38be6cb7c2cbd53a133291b2750d053877ebe4f Mon Sep 17 00:00:00 2001 From: intrigeri Date: Fri, 3 May 2013 17:09:34 +0200 Subject: Wheezy was released! --- lib/puppet/parser/functions/debian_nextcodename.rb | 3 ++- lib/puppet/parser/functions/debian_release.rb | 6 +++--- lib/puppet/parser/functions/debian_release_version.rb | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/puppet/parser/functions/debian_nextcodename.rb b/lib/puppet/parser/functions/debian_nextcodename.rb index f57dd2a..3d5c3bd 100644 --- a/lib/puppet/parser/functions/debian_nextcodename.rb +++ b/lib/puppet/parser/functions/debian_nextcodename.rb @@ -4,7 +4,8 @@ module Puppet::Parser::Functions when "etch" then "lenny" when "lenny" then "squeeze" when "squeeze" then "wheezy" - when "wheezy" then "sid" + when "wheezy" then "jessie" + when "jessie" then "sid" when "sid" then "experimental" else "sid" end diff --git a/lib/puppet/parser/functions/debian_release.rb b/lib/puppet/parser/functions/debian_release.rb index 857edf3..d7b6718 100644 --- a/lib/puppet/parser/functions/debian_release.rb +++ b/lib/puppet/parser/functions/debian_release.rb @@ -1,9 +1,9 @@ module Puppet::Parser::Functions newfunction(:debian_release, :type => :rvalue) do |args| case args[0] - when 'lenny' then 'oldstable' - when 'squeeze' then 'stable' - when 'wheezy' then 'testing' + when 'squeeze' then 'oldstable' + when 'wheezy' then 'stable' + when 'jessie' then 'testing' when 'sid' then 'unstable' when 'experimental' then 'experimental' else 'testing' diff --git a/lib/puppet/parser/functions/debian_release_version.rb b/lib/puppet/parser/functions/debian_release_version.rb index ff58f72..0abe90e 100644 --- a/lib/puppet/parser/functions/debian_release_version.rb +++ b/lib/puppet/parser/functions/debian_release_version.rb @@ -4,6 +4,7 @@ module Puppet::Parser::Functions when 'etch' then '4.0' when 'lenny' then '5.0' when 'squeeze' then '6.0' + when 'wheezy' then '7.0' else '' end end -- cgit v1.2.3