support an array of mirrors for site::aptrepo
authorPeter Palfrader <peter@palfrader.org>
Fri, 21 Oct 2016 11:12:30 +0000 (11:12 +0000)
committerPeter Palfrader <peter@palfrader.org>
Fri, 21 Oct 2016 11:12:30 +0000 (11:12 +0000)
modules/debian-org/manifests/init.pp
modules/site/templates/aptrepo.erb

index 44bedce..c452d66 100644 (file)
@@ -3,15 +3,16 @@
 # Stuff common to all debian.org servers
 #
 class debian-org {
+       if $::lsbmajdistrelease <= 8 {
+               $fallbackmirror = 'http://cdn-fastly.deb.debian.org/debian/'
+       } else {
+               $fallbackmirror = 'http://deb.debian.org/debian/'
+       }
+
        if getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') {
-               $mirror = getfromhash($site::nodeinfo, 'hoster', 'mirror-debian')
+               $mirror = [ getfromhash($site::nodeinfo, 'hoster', 'mirror-debian'), $fallbackmirror ]
        } else {
-               #$mirror = 'http://ftp.debian.org/debian/'
-               if $::lsbmajdistrelease <= 8 {
-                       $mirror = 'http://cdn-fastly.deb.debian.org/debian/'
-               } else {
-                       $mirror = 'http://deb.debian.org/debian/'
-               }
+               $mirror = [ $fallbackmirror ]
        }
 
        if $::lsbmajdistrelease <= 7 {
@@ -141,6 +142,7 @@ class debian-org {
                        ensure => absent,
                }
        }
+
        site::aptrepo { 'debian-lts':
                ensure => absent,
        }
@@ -150,11 +152,6 @@ class debian-org {
                suite      => "${::lsbdistcodename}-backports",
                components => ['main','contrib','non-free']
        }
-       site::aptrepo { 'backports2.debian.org':
-               url        => "http://cdn-fastly.deb.debian.org/debian",
-               suite      => "${::lsbdistcodename}-backports",
-               components => ['main','contrib','non-free']
-       }
 
        site::aptrepo { 'volatile':
                url        => $mirror,
@@ -174,10 +171,6 @@ class debian-org {
                }
        }
 
-       site::aptrepo { 'debian.org':
-               ensure => absent,
-       }
-
        site::aptrepo { 'db.debian.org':
                url        => 'http://db.debian.org/debian-admin',
                suite      => 'debian-all',
@@ -207,15 +200,23 @@ class debian-org {
                        components => ['main','contrib','non-free']
                }
        }
+
        site::aptrepo { 'debian-cdn':
                ensure => absent,
        }
-
+       site::aptrepo { 'debian.org':
+               ensure => absent,
+       }
        site::aptrepo { 'debian2':
                url        => "http://cdn-fastly.deb.debian.org/debian",
-               suite      => $mungedcodename,
-               components => ['main','contrib','non-free']
+               ensure => absent,
        }
+       site::aptrepo { 'backports2.debian.org':
+               ensure => absent,
+       }
+
+
+
 
        file { '/etc/facter':
                ensure  => directory,
index 9469d13..33d4c69 100644 (file)
@@ -3,4 +3,16 @@
 ### USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
 ###
 
-deb     <%= scope.lookupvar('url') %>  <%= scope.lookupvar('suite') %> <%= [scope.lookupvar('components')].flatten.join(' ') %>
+<%=
+  url        = [scope.lookupvar('url')  ].flatten
+  suite      = [scope.lookupvar('suite')].flatten
+  components = [scope.lookupvar('components')].flatten.join(' ')
+
+  lines = []
+  url.each do |u|
+    suite.each do |s|
+      lines << "deb    #{u}    #{s}    #{components}"
+    end
+  end
+  lines.join("\n")
+%>