fix check of release parameter

This commit is contained in:
Steffen Zieger 2012-07-03 23:49:01 +02:00
parent 710b1c6a66
commit d49dbb49ae
3 changed files with 17 additions and 5 deletions

View file

@ -4,7 +4,7 @@
define apt::source(
$ensure = present,
$location = '',
$release = $::lsbdistcodename,
$release = 'UNDEF',
$repos = 'main',
$include_src = true,
$required_packages = false,
@ -21,8 +21,14 @@ define apt::source(
$sources_list_d = $apt::params::sources_list_d
$provider = $apt::params::provider
if $release == undef {
fail('lsbdistcodename fact not available: release parameter required')
if $release == 'UNDEF' {
if $::lsbdistcodename == undef {
fail('lsbdistcodename fact not available: release parameter required')
} else {
$release_real = $::lsbdistcodename
}
} else {
$release_real = $release
}
file { "${name}.list":

View file

@ -42,6 +42,12 @@ describe 'apt::source', :type => :define do
:location => 'http://example.com',
:release => 'precise',
:repos => 'security',
},
{
:release => '',
},
{
:release => 'custom',
}
].each do |param_set|
describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do

View file

@ -1,5 +1,5 @@
# <%= name %>
deb <%= location %> <%= release %> <%= repos %>
deb <%= location %> <%= release_real %> <%= repos %>
<%- if include_src then -%>
deb-src <%= location %> <%= release %> <%= repos %>
deb-src <%= location %> <%= release_real %> <%= repos %>
<%- end -%>