push logic behind apt::repos back in apt::params

The logic in specifying the default value for apt::repos is in the wrong
place: it should be in apt::params since this is exactly what this
latter class is for.

There's no special case that can involve making default the value follow
the value of another parameter so there's no point in having that logic
in the main class.
This commit is contained in:
Gabriel Filion 2015-10-03 01:18:07 -04:00
parent 770f8fb5da
commit 0752201ce4
4 changed files with 14 additions and 18 deletions

View file

@ -20,20 +20,6 @@ class apt(
$custom_sources_list = '',
$custom_key_dir = $apt::params::custom_key_dir
) inherits apt::params {
case $::operatingsystem {
'debian': {
$real_repos = $repos ? {
'auto' => 'main contrib non-free',
default => $repos,
}
}
'ubuntu': {
$real_repos = $repos ? {
'auto' => 'main restricted universe multiverse',
default => $repos,
}
}
}
$real_backports_url = $backports_url ? {
false => $debian_url,

View file

@ -13,7 +13,17 @@ class apt::params () {
}
$lts_url = $debian_url
$volatile_url = 'http://volatile.debian.org/debian-volatile/'
$repos = 'auto'
case $::operatingsystem {
'debian': {
$repos = 'main contrib non-free'
}
'ubuntu': {
$repos = 'main restricted universe multiverse'
}
default: {
fail("Unsupported system '${::operatingsystem}'.")
}
}
$custom_preferences = ''
$custom_key_dir = false
}

View file

@ -4,7 +4,7 @@
### Debian current: <%= codename=scope.lookupvar('::debian_codename') %>
# basic
deb <%= debian_url=scope.lookupvar('apt::debian_url') %> <%= codename %> <%= lrepos=scope.lookupvar('apt::real_repos') %>
deb <%= debian_url=scope.lookupvar('apt::debian_url') %> <%= codename %> <%= lrepos=scope.lookupvar('apt::repos') %>
<% if include_src=scope.lookupvar('apt::include_src') -%>
deb-src <%= debian_url %> <%= codename %> <%= lrepos %>
<% end -%>

View file

@ -1,8 +1,8 @@
# This file is managed by puppet
# all local modifications will be overwritten
# basic <%= codename=scope.lookupvar('::ubuntu_codename') %>
deb <%= ubuntu_url=scope.lookupvar('apt::ubuntu_url') %> <%= codename %> <%= lrepos=scope.lookupvar('apt::real_repos') %>
# basic <%= codename=scope.lookupvar('apt::codename') %>
deb <%= ubuntu_url=scope.lookupvar('apt::ubuntu_url') %> <%= codename %> <%= lrepos=scope.lookupvar('apt::repos') %>
<% if include_src=scope.lookupvar('apt::include_src') -%>
deb-src <%= ubuntu_url %> <%= codename %> <%= lrepos %>
<% end -%>