make backports_url follow debian_url by default

backports_url was already set to the same value than debian_url by
default, but it was set to the default value of debian_url. this meant
that when giving a url to the debian_url parameter to the apt class, the
backports_url would not follow and would still be using the default
value for debian_url.

with this change, when backports_url is not specified, but debian_url
is, then both of them take on the value given to the debian_url. of
course if backports_url is also given a value, then it keeps the value
given by the user.
This commit is contained in:
Gabriel Filion 2015-10-03 01:13:50 -04:00
parent 8c8bd7bb1e
commit 770f8fb5da
2 changed files with 8 additions and 6 deletions

View file

@ -35,6 +35,11 @@ class apt(
} }
} }
$real_backports_url = $backports_url ? {
false => $debian_url,
default => $backports_url,
}
package { 'apt': package { 'apt':
ensure => installed, ensure => installed,
require => undef, require => undef,
@ -99,12 +104,12 @@ class apt(
if ($use_backports and !($::debian_release in ['testing', 'unstable', 'experimental'])) { if ($use_backports and !($::debian_release in ['testing', 'unstable', 'experimental'])) {
apt::sources_list { apt::sources_list {
'backports': 'backports':
content => "deb $backports_url ${::debian_codename}-backports ${apt::real_repos}", content => "deb ${real_backports_url} ${::debian_codename}-backports ${apt::repos}",
} }
if $include_src { if $include_src {
apt::sources_list { apt::sources_list {
'backports-src': 'backports-src':
content => "deb-src $backports_url ${::debian_codename}-backports ${apt::real_repos}", content => "deb-src ${real_backports_url} ${::debian_codename}-backports ${apt::repos}",
} }
} }
} }

View file

@ -9,10 +9,7 @@ class apt::params () {
$ubuntu_url = 'http://archive.ubuntu.com/ubuntu' $ubuntu_url = 'http://archive.ubuntu.com/ubuntu'
$backports_url = $::debian_codename ? { $backports_url = $::debian_codename ? {
'squeeze' => 'http://backports.debian.org/debian-backports/', 'squeeze' => 'http://backports.debian.org/debian-backports/',
default => $::operatingsystem ? { default => false,
'Ubuntu' => $ubuntu_url,
default => $debian_url,
}
} }
$lts_url = $debian_url $lts_url = $debian_url
$volatile_url = 'http://volatile.debian.org/debian-volatile/' $volatile_url = 'http://volatile.debian.org/debian-volatile/'