Merge branch 'master' into leap

This commit is contained in:
Micah Anderson 2013-05-26 17:04:05 -04:00
commit 61a2f48948
6 changed files with 52 additions and 27 deletions

View file

@ -4,7 +4,8 @@ module Puppet::Parser::Functions
when "etch" then "lenny" when "etch" then "lenny"
when "lenny" then "squeeze" when "lenny" then "squeeze"
when "squeeze" then "wheezy" when "squeeze" then "wheezy"
when "wheezy" then "sid" when "wheezy" then "jessie"
when "jessie" then "sid"
when "sid" then "experimental" when "sid" then "experimental"
else "sid" else "sid"
end end

View file

@ -1,9 +1,9 @@
module Puppet::Parser::Functions module Puppet::Parser::Functions
newfunction(:debian_release, :type => :rvalue) do |args| newfunction(:debian_release, :type => :rvalue) do |args|
case args[0] case args[0]
when 'lenny' then 'oldstable' when 'squeeze' then 'oldstable'
when 'squeeze' then 'stable' when 'wheezy' then 'stable'
when 'wheezy' then 'testing' when 'jessie' then 'testing'
when 'sid' then 'unstable' when 'sid' then 'unstable'
when 'experimental' then 'experimental' when 'experimental' then 'experimental'
else 'testing' else 'testing'

View file

@ -4,6 +4,7 @@ module Puppet::Parser::Functions
when 'etch' then '4.0' when 'etch' then '4.0'
when 'lenny' then '5.0' when 'lenny' then '5.0'
when 'squeeze' then '6.0' when 'squeeze' then '6.0'
when 'wheezy' then '7.0'
else '' else ''
end end
end end

View file

@ -4,19 +4,19 @@
# See LICENSE for the full license granted to you. # See LICENSE for the full license granted to you.
class apt( class apt(
$codename = $::lsbdistcodename, $codename = $apt::params::codename,
$use_volatile = false, $use_volatile = $apt::params::use_volatile,
$include_src = false, $include_src = $apt::params::include_src,
$use_next_release = false, $use_next_release = $apt::params::use_next_release,
$debian_url = 'http://http.debian.net/debian/', $debian_url = $apt::params::debian_url,
$security_url = 'http://security.debian.org/', $security_url = $apt::params::security_url,
$backports_url = 'http://backports.debian.org/debian-backports/', $backports_url = $apt::params::backports_url,
$volatile_url = 'http://volatile.debian.org/debian-volatile/', $volatile_url = $apt::params::volatile_url,
$ubuntu_url = 'http://archive.ubuntu.com/ubuntu', $ubuntu_url = $apt::params::ubuntu_url,
$repos = 'auto', $repos = $apt::params::repos,
$custom_preferences = '', $custom_preferences = $apt::params::custom_preferences,
$disable_update = false $disable_update = $apt::params::disable_update
){ ) inherits apt::params {
case $::operatingsystem { case $::operatingsystem {
'debian': { 'debian': {
$real_repos = $repos ? { $real_repos = $repos ? {
@ -26,7 +26,7 @@ class apt(
} }
'ubuntu': { 'ubuntu': {
$real_repos = $repos ? { $real_repos = $repos ? {
'' => 'main restricted universe multiverse', 'auto' => 'main restricted universe multiverse',
default => $repos, default => $repos,
} }
} }

17
manifests/params.pp Normal file
View file

@ -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
}

View file

@ -1,5 +1,5 @@
define apt::preferences_snippet ( define apt::preferences_snippet (
$priority, $priority = undef,
$package = false, $package = false,
$ensure = 'present', $ensure = 'present',
$source = '', $source = '',
@ -12,15 +12,21 @@ define apt::preferences_snippet (
default => $package, default => $package,
} }
if $custom_preferences == false { if $ensure == 'present' {
fail('Trying to define a preferences_snippet with $custom_preferences set to false.') if $custom_preferences == false {
} fail('Trying to define a preferences_snippet with $custom_preferences set to false.')
}
if !$pin and !$release { if $priority == undef {
fail('apt::preferences_snippet requires one of the \'pin\' or \'release\' argument to be set') fail('apt::preferences_snippet requires the \'priority\' argument to be set')
} }
if $pin and $release {
fail('apt::preferences_snippet requires either a \'pin\' or \'release\' argument, not both') 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}": file { "/etc/apt/preferences.d/${name}":