diff options
-rw-r--r-- | lib/puppet/parser/functions/debian_nextcodename.rb | 3 | ||||
-rw-r--r-- | lib/puppet/parser/functions/debian_release.rb | 6 | ||||
-rw-r--r-- | lib/puppet/parser/functions/debian_release_version.rb | 1 | ||||
-rw-r--r-- | manifests/init.pp | 28 | ||||
-rw-r--r-- | manifests/params.pp | 17 | ||||
-rw-r--r-- | manifests/preferences_snippet.pp | 24 |
6 files changed, 52 insertions, 27 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 diff --git a/manifests/init.pp b/manifests/init.pp index 0f60efb..faddf09 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 ? { @@ -26,7 +26,7 @@ class apt( } 'ubuntu': { $real_repos = $repos ? { - '' => 'main restricted universe multiverse', + 'auto' => 'main restricted universe multiverse', default => $repos, } } diff --git a/manifests/params.pp b/manifests/params.pp new file mode 100644 index 0000000..b210ff6 --- /dev/null +++ b/manifests/params.pp @@ -0,0 +1,17 @@ +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 = $::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' + $custom_preferences = '' + $disable_update = false +} 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}": |