]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - modules/site/manifests/aptrepo.pp
make site::aptrepo a proper type
[dsa-puppet.git] / modules / site / manifests / aptrepo.pp
index cea4281e21c81019d1205250c41f9bca3470c8c1..c97fade0ea3f6660273676bf628de545a750b186 100644 (file)
@@ -1,4 +1,11 @@
-define site::aptrepo ($key = undef, $keyid = undef, $template = undef, $config = undef, $ensure = present) {
+define site::aptrepo (
+       $url,
+       $suite,
+       $components=[],
+       $key = undef,
+       $keyid = undef,
+       $ensure = present
+) {
 
        case $ensure {
                present: {
@@ -31,26 +38,16 @@ 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}",
                                }
                        }
                }
                default: { fail ( "Unknown ensure value: '$ensure'" ) }
        }
 
-       if $ensure == present {
-               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'],
+                       ensure  => $ensure,
+                       content => template('site/aptrepo.erb'),
+                       notify => Exec['apt-get update'],
        }
 }