From 3ae1d19e3d1e64321475bceed121a37522dd8226 Mon Sep 17 00:00:00 2001 From: Stephen Gran Date: Mon, 16 Apr 2012 15:45:47 +0100 Subject: [PATCH] this is supposed to work Signed-off-by: Stephen Gran --- modules/site/manifests/aptrepo.pp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/modules/site/manifests/aptrepo.pp b/modules/site/manifests/aptrepo.pp index ae66d6f2..cea4281e 100644 --- a/modules/site/manifests/aptrepo.pp +++ b/modules/site/manifests/aptrepo.pp @@ -1,6 +1,5 @@ define site::aptrepo ($key = undef, $keyid = undef, $template = undef, $config = undef, $ensure = present) { - case $ensure { present: { if $key { @@ -32,7 +31,7 @@ define site::aptrepo ($key = undef, $keyid = undef, $template = undef, $config = } } elsif $keyid { exec { "apt-key-del-${keyid}": - command => "apt-key del ${keyid}", + command => "apt-key del ${keyid}", } } } @@ -43,19 +42,15 @@ define site::aptrepo ($key = undef, $keyid = undef, $template = undef, $config = if ! ($config or $template) { fail ( "No configuration found for ${name}" ) } + if ($config and $template) { + fail ( "Can't specify both config and template for ${name}" ) + } } - if $template { - file { "/etc/apt/sources.list.d/${name}.list": - ensure => $ensure, - content => template($template), - notify => Exec['apt-get update'], - } - } else { - file { "/etc/apt/sources.list.d/${name}.list": - ensure => $ensure, - source => $config, - notify => Exec['apt-get update'], - } + file { "/etc/apt/sources.list.d/${name}.list": + ensure => $ensure, + content => template($template), + source => $config, + notify => Exec['apt-get update'], } } -- 2.39.2