]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - modules/site/manifests/aptrepo.pp
try to order these a bit
[dsa-puppet.git] / modules / site / manifests / aptrepo.pp
index cea4281e21c81019d1205250c41f9bca3470c8c1..b71c5fa25c3f4289a81b889c8767de97a7cbc971 100644 (file)
@@ -5,12 +5,14 @@ define site::aptrepo ($key = undef, $keyid = undef, $template = undef, $config =
                        if $key {
                                exec { "apt-key-update-${name}":
                                        command     => "apt-key add /etc/apt/trusted-keys.d/${name}.asc",
+                                       stage       => setup,
                                        refreshonly => true,
                                }
 
                                file { "/etc/apt/trusted-keys.d/${name}.asc":
                                        source => $key,
                                        mode   => '0664',
+                                       stage  => setup,
                                        notify => Exec["apt-key-update-${name}"]
                                }
                        }
@@ -19,19 +21,23 @@ define site::aptrepo ($key = undef, $keyid = undef, $template = undef, $config =
                        if ($keyid) and ($key) {
                                file { "/etc/apt/trusted-keys.d/${name}.asc":
                                        ensure => absent,
+                                       stage  => setup,
                                        notify => Exec["apt-key-del-${keyid}"]
                                }
                                exec { "apt-key-del-${keyid}":
                                        command     => "apt-key del ${keyid}",
+                                       stage       => setup,
                                        refreshonly => true,
                                }
                        } elsif $key {
                                file { "/etc/apt/trusted-keys.d/${name}.asc":
                                        ensure => absent,
+                                       stage  => setup,
                                }
                        } elsif $keyid {
                                exec { "apt-key-del-${keyid}":
                                        command => "apt-key del ${keyid}",
+                                       stage   => setup,
                                }
                        }
                }
@@ -42,15 +48,19 @@ 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'],
+               }
+       } else {
+               file { "/etc/apt/sources.list.d/${name}.list":
+                       ensure  => $ensure,
+                       source  => $config,
+                       notify  => Exec['apt-get update'],
+               }
        }
 }