refactor things for >2.7

This commit is contained in:
mh 2012-06-08 12:16:46 -03:00
parent 39917fb4db
commit ac166366d7
8 changed files with 49 additions and 51 deletions

View file

@ -6,7 +6,7 @@
class apt( class apt(
$use_volatile = hiera('apt_volatile_enabled',false), $use_volatile = hiera('apt_volatile_enabled',false),
$include_src = hiera('apt_include_src',false), $include_src = hiera('apt_include_src',false),
$use_next_release = hiera('apt_use_next_release'), $use_next_release = hiera('apt_use_next_release',false),
$debian_url = hiera('apt_debian_url','http://cdn.debian.net/debian/'), $debian_url = hiera('apt_debian_url','http://cdn.debian.net/debian/'),
$security_url = hiera('apt_security_url','http://security.debian.org/'), $security_url = hiera('apt_security_url','http://security.debian.org/'),
$backports_url = hiera('apt_backports_url','http://backports.debian.org/debian-backports/'), $backports_url = hiera('apt_backports_url','http://backports.debian.org/debian-backports/'),
@ -40,16 +40,14 @@ class apt(
# init $release, $next_release, $codename, $next_codename, $release_version # init $release, $next_release, $codename, $next_codename, $release_version
case $::lsbdistcodename { case $::lsbdistcodename {
'': { '': {
$codename = $::lsbdistcodename
$release = $::lsbdistrelease $release = $::lsbdistrelease
} }
default: { default: {
$codename = $::lsbdistcodename $release = debian_release($::lsbdistcodename)
$release = debian_release($codename)
} }
} }
$release_version = debian_release_version($codename) $release_version = debian_release_version($::lsbdistcodename)
$next_codename = debian_nextcodename($codename) $next_codename = debian_nextcodename($::lsbdistcodename)
$next_release = debian_nextrelease($release) $next_release = debian_nextrelease($release)
config_file { config_file {

View file

@ -3,8 +3,8 @@ class apt::preferences {
concat::fragment{"apt_preferences_header": concat::fragment{"apt_preferences_header":
content => $apt::custom_preferences ? { content => $apt::custom_preferences ? {
'' => $::operatingsystem ? { '' => $::operatingsystem ? {
'debian' => template("apt/${::operatingsystem}/preferences_${::codename}.erb"), 'debian' => template("apt/${::operatingsystem}/preferences_${::lsbdistcodename}.erb"),
'ubuntu' => template("apt/${::operatingsystem}/preferences_${::codename}.erb"), 'ubuntu' => template("apt/${::operatingsystem}/preferences_${::lsbdistcodename}.erb"),
}, },
default => $custom_preferences default => $custom_preferences
}, },

View file

@ -1,6 +1,6 @@
Explanation: Debian <%= codename %> Explanation: Debian <%= scope.lookupvar('::lsbdistcodename') %>
Package: * Package: *
Pin: release o=Debian,a=<%= release %>,v=<%= release_version %>* Pin: release o=Debian,a=<%= scope.lookupvar('apt::release') %>,v=<%= scope.lookupvar('apt::release_version') %>*
Pin-Priority: 990 Pin-Priority: 990
Explanation: Debian backports Explanation: Debian backports
@ -8,9 +8,9 @@ Package: *
Pin: origin backports.debian.org Pin: origin backports.debian.org
Pin-Priority: 200 Pin-Priority: 200
Explanation: Debian <%= next_release %> Explanation: Debian <%= scope.lookupvar('apt::next_release') %>
Package: * Package: *
Pin: release o=Debian,a=<%= next_release %> Pin: release o=Debian,a=<%= scope.lookupvar('apt::next_release') %>
Pin-Priority: 2 Pin-Priority: 2
Explanation: Debian sid Explanation: Debian sid

View file

@ -1,16 +1,16 @@
Explanation: Debian <%= codename %> Explanation: Debian <%= scope.lookupvar('::lsbdistcodename') %>
Package: * Package: *
Pin: release o=Debian,n=<%= codename %> Pin: release o=Debian,n=<%= scope.lookupvar('::lsbdistcodename') %>
Pin-Priority: 990 Pin-Priority: 990
Explanation: Debian <%= codename %>-updates Explanation: Debian <%= scope.lookupvar('::lsbdistcodename') %>-updates
Package: * Package: *
Pin: release o=Debian,n=<%= codename %>-updates Pin: release o=Debian,n=<%= scope.lookupvar('::lsbdistcodename') %>-updates
Pin-Priority: 990 Pin-Priority: 990
Explanation: Debian <%= next_codename %> Explanation: Debian <%= scope.lookupvar('apt::next_codename') %>
Package: * Package: *
Pin: release o=Debian,n=<%= next_codename %> Pin: release o=Debian,n=<%= scope.lookupvar('apt::next_codename') %>
Pin-Priority: 2 Pin-Priority: 2
Explanation: Debian sid Explanation: Debian sid

View file

@ -1,11 +1,11 @@
Explanation: Debian <%= codename %> Explanation: Debian <%= scope.lookupvar('::lsbdistcodename') %>
Package: * Package: *
Pin: release o=Debian,n=<%= codename %> Pin: release o=Debian,n=<%= scope.lookupvar('::lsbdistcodename') %>
Pin-Priority: 990 Pin-Priority: 990
Explanation: Debian <%= codename %>-updates Explanation: Debian <%= scope.lookupvar('::lsbdistcodename') %>-updates
Package: * Package: *
Pin: release o=Debian,n=<%= codename %>-updates Pin: release o=Debian,n=<%= scope.lookupvar('::lsbdistcodename') %>-updates
Pin-Priority: 990 Pin-Priority: 990
Explanation: Debian sid Explanation: Debian sid

View file

@ -1,20 +1,20 @@
# This file is managed by puppet # This file is managed by puppet
# all local modifications will be overwritten # all local modifications will be overwritten
### Debian current: <%= codename %> ### Debian current: <%= codename = scope.lookupvar('::lsbdistcodename') %>
# basic # basic
deb <%= debian_url %> <%= codename %> <%= repos %> deb <%= debian_url=scope.lookupvar('apt::debian_url') %> <%= codename %> <%= repos=scope.lookupvar('apt::repos') %>
<% if include_src then -%> <% if scope.lookupvar('apt::include_src') -%>
deb-src <%= debian_url %> <%= codename %> <%= repos %> deb-src <%= debian_url %> <%= codename %> <%= repos %>
<% end -%> <% end -%>
# security # security
<% if (release == "unstable" || release == "experimental") -%> <% if ((release=scope.lookupvar('apt::release')) == "unstable" || release == "experimental") -%>
# There is no security support for <%= release %> # There is no security support for <%= release %>
<% else -%> <% else -%>
deb <%= security_url %> <%= codename %>/updates <%= repos %> deb <%= security_url=scope.lookupvar('apt::security_url') %> <%= codename %>/updates <%= repos %>
<% if include_src then -%> <% if include_src -%>
deb-src <%= security_url %> <%= codename %>/updates <%= repos %> deb-src <%= security_url %> <%= codename %>/updates <%= repos %>
<% end -%> <% end -%>
<% end -%> <% end -%>
@ -23,33 +23,33 @@ deb-src <%= security_url %> <%= codename %>/updates <%= repos %>
<% if (release == "testing" || release == "unstable" || release == "experimental") -%> <% if (release == "testing" || release == "unstable" || release == "experimental") -%>
# There is no backports archive for <%= release %> # There is no backports archive for <%= release %>
<% else -%> <% else -%>
deb <%= backports_url %> <%= codename %>-backports <%= repos %> deb <%= backports_url=scope.lookupvar('apt::backports_url') %> <%= codename %>-backports <%= repos %>
<% if include_src then -%> <% if include_src -%>
deb-src <%= backports_url %> <%= codename %>-backports <%= repos %> deb-src <%= backports_url %> <%= codename %>-backports <%= repos %>
<% end -%> <% end -%>
<% end -%> <% end -%>
<% if use_volatile -%> <% if use_volatile=scope.lookupvar('apt::use_volatile') -%>
# volatile # volatile
<% if (release == "testing" || release == "unstable" || release == "experimental") -%> <% if (release == "testing" || release == "unstable" || release == "experimental") -%>
# There is no volatile archive for <%= release %> # There is no volatile archive for <%= release %>
<% else -%> <% else -%>
<% if (codename == "lenny" || codename == "etch") -%> <% if (codename == "lenny" || codename == "etch") -%>
deb <%= volatile_url %> <%= codename %>/volatile <%= repos %> deb <%= volatile_url=scope.lookupvar('apt::volatile_url') %> <%= codename %>/volatile <%= repos %>
<% if include_src then -%> <% if include_src -%>
deb-src <%= volatile_url %> <%= codename %>/volatile <%= repos %> deb-src <%= volatile_url %> <%= codename %>/volatile <%= repos %>
<% end -%> <% end -%>
<% else -%> <% else -%>
deb <%= debian_url %> <%= codename %>-updates <%= repos %> deb <%= debian_url %> <%= codename %>-updates <%= repos %>
<% if include_src then -%> <% if include_src -%>
deb-src <%= debian_url %> <%= codename %>-updates <%= repos %> deb-src <%= debian_url %> <%= codename %>-updates <%= repos %>
<% end -%> <% end -%>
<% end -%> <% end -%>
<% end -%> <% end -%>
<% end -%> <% end -%>
<% if use_next_release then -%> <% if next_release=scope.lookupvar('apt::use_next_release') -%>
### Debian next: <%= next_codename %> ### Debian next: <%= next_codename=scope.lookupvar('apt::next_codename') %>
# basic # basic
deb <%= debian_url %> <%= next_codename %> <%= repos %> deb <%= debian_url %> <%= next_codename %> <%= repos %>

View file

@ -1,26 +1,26 @@
Explanation: Ubuntu <%= codename %> security Explanation: Ubuntu <%= scope.lookupvar('::lsbdistcodename') %> security
Package: * Package: *
Pin: release o=Ubuntu,a=<%= codename %>-security Pin: release o=Ubuntu,a=<%= scope.lookupvar('::lsbdistcodename') %>-security
Pin-Priority: 990 Pin-Priority: 990
Explanation: Ubuntu <%= codename %> updates Explanation: Ubuntu <%= scope.lookupvar('::lsbdistcodename') %> updates
Package: * Package: *
Pin: release o=Ubuntu,a=<%= codename %>-updates Pin: release o=Ubuntu,a=<%= scope.lookupvar('::lsbdistcodename') %>-updates
Pin-Priority: 980 Pin-Priority: 980
Explanation: Ubuntu <%= codename %> Explanation: Ubuntu <%= scope.lookupvar('::lsbdistcodename') %>
Package: * Package: *
Pin: release o=Ubuntu,a=<%= codename %> Pin: release o=Ubuntu,a=<%= scope.lookupvar('::lsbdistcodename') %>
Pin-Priority: 970 Pin-Priority: 970
Explanation: Ubuntu backports Explanation: Ubuntu backports
Package: * Package: *
Pin: release a=<%= codename %>-backports Pin: release a=<%= scope.lookupvar('::lsbdistcodename') %>-backports
Pin-Priority: 200 Pin-Priority: 200
Explanation: Ubuntu <%= next_release %> Explanation: Ubuntu <%= scope.lookupvar('apt::next_release') %>
Package: * Package: *
Pin: release o=Ubuntu,a=<%= next_release %> Pin: release o=Ubuntu,a=<%= scope.lookupvar('apt::next_release') %>
Pin-Priority: 2 Pin-Priority: 2
Explanation: Ubuntu fallback Explanation: Ubuntu fallback

View file

@ -1,26 +1,26 @@
# This file is managed by puppet # This file is managed by puppet
# all local modifications will be overwritten # all local modifications will be overwritten
# basic <%= lsbdistcodename %> # basic <%= lsbdistcodename=scope.lookupvar('::lsbdistcodename') %>
deb <%= ubuntu_url %> <%= lsbdistcodename %> <%= repos %> deb <%= ubuntu_url=scope.lookupvar('apt::ubuntu_url') %> <%= lsbdistcodename %> <%= repos=scope.lookupvar('apt::repos') %>
<% if include_src then -%> <% if include_src=scope.lookupvar('apt::include_src') -%>
deb-src <%= ubuntu_url %> <%= lsbdistcodename %> <%= repos %> deb-src <%= ubuntu_url %> <%= lsbdistcodename %> <%= repos %>
<% end -%> <% end -%>
# updates # updates
deb <%= ubuntu_url %> <%= lsbdistcodename %>-updates <%= repos %> deb <%= ubuntu_url %> <%= lsbdistcodename %>-updates <%= repos %>
<% if include_src then -%> <% if include_src -%>
deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-updates <%= repos %> deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-updates <%= repos %>
<% end -%> <% end -%>
# security suppport # security suppport
deb <%= ubuntu_url %> <%= lsbdistcodename %>-security <%= repos %> deb <%= ubuntu_url %> <%= lsbdistcodename %>-security <%= repos %>
<% if include_src then -%> <% if include_src -%>
deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-security <%= repos %> deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-security <%= repos %>
<% end -%> <% end -%>
# backports # backports
deb <%= ubuntu_url %> <%= lsbdistcodename %>-backports main <%= repos %> deb <%= ubuntu_url %> <%= lsbdistcodename %>-backports main <%= repos %>
<% if include_src then -%> <% if include_src -%>
deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-backports <%= repos %> deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-backports <%= repos %>
<% end -%> <% end -%>