X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fsite%2Fmanifests%2Faptrepo.pp;h=d0e34ecaf8dddfcb6145725186f4013a8b93d817;hb=e3c7ba19631d0ae3007879027a8cdde5fb4e4250;hp=cea4281e21c81019d1205250c41f9bca3470c8c1;hpb=3ae1d19e3d1e64321475bceed121a37522dd8226;p=mirror%2Fdsa-puppet.git diff --git a/modules/site/manifests/aptrepo.pp b/modules/site/manifests/aptrepo.pp index cea4281e2..d0e34ecaf 100644 --- a/modules/site/manifests/aptrepo.pp +++ b/modules/site/manifests/aptrepo.pp @@ -1,4 +1,5 @@ -define site::aptrepo ($key = undef, $keyid = undef, $template = undef, $config = undef, $ensure = present) { +define site::aptrepo ($key = undef, $keyid = undef, $template = undef, $config = undef, $ensure = present, $require = []) { + case $ensure { present: { @@ -31,7 +32,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}", } } } @@ -42,15 +43,21 @@ 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}" ) - } } - file { "/etc/apt/sources.list.d/${name}.list": - ensure => $ensure, - content => template($template), - source => $config, - notify => Exec['apt-get update'], + if $template { + file { "/etc/apt/sources.list.d/${name}.list": + ensure => $ensure, + content => template($template), + notify => Exec['apt-get update'], + require => $require, + } + } else { + file { "/etc/apt/sources.list.d/${name}.list": + ensure => $ensure, + source => $config, + notify => Exec['apt-get update'], + require => $require, + } } }