From aa05fcb708fb1f890d317fed06ca4e670e2d6ccc Mon Sep 17 00:00:00 2001 From: Stephen Gran Date: Wed, 2 May 2012 08:57:33 +0100 Subject: [PATCH] check url and suite only if ensure => present Signed-off-by: Stephen Gran --- modules/site/manifests/aptrepo.pp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/site/manifests/aptrepo.pp b/modules/site/manifests/aptrepo.pp index c97fade0e..52036ed9d 100644 --- a/modules/site/manifests/aptrepo.pp +++ b/modules/site/manifests/aptrepo.pp @@ -1,6 +1,6 @@ define site::aptrepo ( - $url, - $suite, + $url='', + $suite='', $components=[], $key = undef, $keyid = undef, @@ -45,6 +45,15 @@ define site::aptrepo ( default: { fail ( "Unknown ensure value: '$ensure'" ) } } + case $ensure { + present: { + if !($url and $suite) { + fail ( "Need both url and suite for $name" ) + } + } + default: {} + } + file { "/etc/apt/sources.list.d/${name}.list": ensure => $ensure, content => template('site/aptrepo.erb'), -- 2.20.1