]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
make site::aptrepo a proper type
authorStephen Gran <steve@lobefin.net>
Wed, 2 May 2012 07:45:50 +0000 (08:45 +0100)
committerStephen Gran <steve@lobefin.net>
Wed, 2 May 2012 07:50:30 +0000 (08:50 +0100)
Signed-off-by: Stephen Gran <steve@lobefin.net>
14 files changed:
modules/buildd/manifests/init.pp
modules/buildd/templates/etc/apt/sources.list.d/buildd.list.erb [deleted file]
modules/debian-org/manifests/init.pp
modules/debian-org/manifests/proliant.pp
modules/debian-org/templates/etc/apt/sources.list.d/backports.debian.org.list.erb [deleted file]
modules/debian-org/templates/etc/apt/sources.list.d/debian.org.list.erb [deleted file]
modules/debian-org/templates/etc/apt/sources.list.d/debian.restricted.list.erb [deleted file]
modules/debian-org/templates/etc/apt/sources.list.d/geoip.list.erb [deleted file]
modules/debian-org/templates/etc/apt/sources.list.d/security.list.erb [deleted file]
modules/debian-org/templates/etc/apt/sources.list.d/volatile.list.erb [deleted file]
modules/megactl/manifests/init.pp
modules/named/manifests/geodns.pp
modules/site/manifests/aptrepo.pp
modules/site/templates/aptrepo.erb [new file with mode: 0644]

index 63c5cf8acc24b49e2e750286f1f3a5b9bca0a62a..b76652c1159de7990c269aec58674783a1507a10 100644 (file)
@@ -31,10 +31,37 @@ class buildd {
        site::aptrepo { 'buildd':
                ensure => absent,
        }
+
+       if $::lsbdistcodename in [squeeze,wheezy] {
+               $suite = $::lsbdistcodename
+       } else {
+               $suite = 'wheezy'
+       }
+
        site::aptrepo { 'buildd.debian.org':
-               template => 'buildd/etc/apt/sources.list.d/buildd.list.erb',
-               key      => 'puppet:///modules/buildd/buildd.debian.org.asc',
-               require  => Package['apt-transport-https'],
+               key        => 'puppet:///modules/buildd/buildd.debian.org.asc',
+               url        => 'https://buildd.debian.org/apt/',
+               suite      => $suite,
+               components => 'main',
+               require    => Package['apt-transport-https'],
+       }
+
+       if $::hostname in [alkman,porpora,zandonai] {
+               site::aptrepo { 'buildd.debian.org-proposed':
+                       url        => 'https://buildd.debian.org/apt/',
+                       suite      => "${suite}-proposed",
+                       components => 'main',
+                       require    => Package['apt-transport-https'],
+               }
+       }
+
+       if $::hostname in [krenek] {
+               site::aptrepo { 'buildd.debian.org-experimental':
+                       url        => 'https://buildd.debian.org/apt/',
+                       suite      => "${suite}-experimental",
+                       components => 'main',
+                       require    => Package['apt-transport-https'],
+               }
        }
 
        # 'bad' extension
diff --git a/modules/buildd/templates/etc/apt/sources.list.d/buildd.list.erb b/modules/buildd/templates/etc/apt/sources.list.d/buildd.list.erb
deleted file mode 100644 (file)
index 8ffb4c6..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-##
-## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-##
-
-<%
-  builddsuites = %w{squeeze wheezy}
-  testingunstable = 'wheezy'
-  if builddsuites.include?(lsbdistcodename)
-    suite = lsbdistcodename
-  else
-    suite = testingunstable
-  end
-%>
-
-# The buildd default repository.
-deb https://buildd.debian.org/apt/ <%= suite %> main
-
-<% if %w{alkman porpora zandonai}.include?(hostname) -%>
-# Include the current test version too.
-deb https://buildd.debian.org/apt/ <%= suite %>-proposed main
-<% elsif %w{krenek}.include?(hostname) -%>
-deb https://buildd.debian.org/apt/ <%= suite %>-experimental main
-<% end %>
index 7dc5f73ff9db02cebbaa2811fcf8a513d9df0f3d..8c76900209ecb9c0ceb804e0929eb4ead90687a3 100644 (file)
@@ -74,13 +74,21 @@ class debian-org {
 
        if $::debarchitecture != 'armhf' {
                site::aptrepo { 'security':
-                       template => 'debian-org/etc/apt/sources.list.d/security.list.erb',
+                       url        => 'http://security.debian.org/',
+                       suite      => "${::lsbdistcodename}/updates",
+                       components => ['main','contrib','non-free']
                }
+
                site::aptrepo { 'backports.debian.org':
-                       template => 'debian-org/etc/apt/sources.list.d/backports.debian.org.list.erb',
+                       url        => 'http://backports.debian.org/debian-backports/',
+                       suite      => "${::lsbdistcodename}-backports",
+                       components => ['main','contrib','non-free']
                }
+
                site::aptrepo { 'volatile':
-                       template => 'debian-org/etc/apt/sources.list.d/volatile.list.erb',
+                       url        => 'http://ftp.debian.org/debian',
+                       suite      => "${::lsbdistcodename}-updates",
+                       components => ['main','contrib','non-free']
                }
        }
        site::aptrepo { 'backports.org':
@@ -94,8 +102,10 @@ class debian-org {
        }
 
        site::aptrepo { 'db.debian.org':
-               template => 'debian-org/etc/apt/sources.list.d/debian.org.list.erb',
-               key      => 'puppet:///modules/debian-org/db.debian.org.asc',
+               url        => 'http://db.debian.org/debian-admin',
+               suite      => 'lenny',
+               components => 'main',
+               key        => 'puppet:///modules/debian-org/db.debian.org.asc',
        }
 
        file { '/etc/facter':
index ea70b92c23b0d5a135d7edae8feb0c349c4d80d1..28a177b4a7ebb4df64f0f9e343609d43f903357d 100644 (file)
@@ -1,7 +1,9 @@
 class debian-org::proliant {
 
        site::aptrepo { 'debian.restricted':
-               template => 'debian-org/etc/apt/sources.list.d/debian.restricted.list.erb',
+               url        => 'http://db.debian.org/debian-admin',
+               suite      => 'lenny-restricted',
+               components => 'non-free',
        }
 
        package { 'hpacucli':
diff --git a/modules/debian-org/templates/etc/apt/sources.list.d/backports.debian.org.list.erb b/modules/debian-org/templates/etc/apt/sources.list.d/backports.debian.org.list.erb
deleted file mode 100644 (file)
index a4238a1..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-##
-## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-##
-
-deb    http://backports.debian.org/debian-backports/   <%= lsbdistcodename %>-backports main contrib non-free
diff --git a/modules/debian-org/templates/etc/apt/sources.list.d/debian.org.list.erb b/modules/debian-org/templates/etc/apt/sources.list.d/debian.org.list.erb
deleted file mode 100644 (file)
index f0673c3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-##
-## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-##
-
-deb     http://db.debian.org/debian-admin          lenny            main
diff --git a/modules/debian-org/templates/etc/apt/sources.list.d/debian.restricted.list.erb b/modules/debian-org/templates/etc/apt/sources.list.d/debian.restricted.list.erb
deleted file mode 100644 (file)
index 666fce8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-##
-## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-##
-
-deb     http://db.debian.org/debian-admin          lenny-restricted non-free
diff --git a/modules/debian-org/templates/etc/apt/sources.list.d/geoip.list.erb b/modules/debian-org/templates/etc/apt/sources.list.d/geoip.list.erb
deleted file mode 100644 (file)
index b39b6be..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-##
-## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-##
-
-deb     http://db.debian.org/debian-admin          lenny-bind-geoip main
diff --git a/modules/debian-org/templates/etc/apt/sources.list.d/security.list.erb b/modules/debian-org/templates/etc/apt/sources.list.d/security.list.erb
deleted file mode 100644 (file)
index 16b45b0..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-##
-## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-##
-
-deb     http://security.debian.org/     <%= lsbdistcodename %>/updates    main contrib non-free
diff --git a/modules/debian-org/templates/etc/apt/sources.list.d/volatile.list.erb b/modules/debian-org/templates/etc/apt/sources.list.d/volatile.list.erb
deleted file mode 100644 (file)
index e55d490..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-##
-## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-##
-
-deb    http://ftp.debian.org/debian    <%= lsbdistcodename %>-updates          main contrib non-free
index e5049722543e8b34646fb973228ab052c43f3d38..252b418e306e28d014e56088105d30491d430284 100644 (file)
@@ -8,6 +8,8 @@ class megactl {
        }
 
        site::aptrepo { 'debian.restricted':
-               template => 'debian-org/etc/apt/sources.list.d/debian.restricted.list.erb',
+               url        => 'http://db.debian.org/debian-admin',
+               suite      => 'lenny-restricted',
+               components => 'non-free',
        }
 }
index b12593dac8b139cc42c0ae36197ef2a329ecf7fe..b00d727898a89992112ee3e3da0af9d608939b97 100644 (file)
@@ -4,7 +4,9 @@ class named::geodns inherits named {
        }
 
        site::aptrepo { 'geoip':
-               template => 'debian-org/etc/apt/sources.list.d/geoip.list.erb',
+               url        => 'http://db.debian.org/debian-admin',
+               suite      => 'lenny-bind-geoip',
+               components => 'main',
        }
 
        file { '/etc/bind/':
index d5bae7812dd5b736b5640a8f0190a3f6cf1cb3d6..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: {
@@ -38,23 +45,9 @@ define site::aptrepo ($key = undef, $keyid = undef, $template = undef, $config =
                default: { fail ( "Unknown ensure value: '$ensure'" ) }
        }
 
-       if $ensure == present {
-               if ! ($config or $template) {
-                       fail ( "No configuration found for ${name}" )
-               }
-       }
-
-       if $template {
-               file { "/etc/apt/sources.list.d/${name}.list":
+       file { "/etc/apt/sources.list.d/${name}.list":
                        ensure  => $ensure,
-                       content => template($template),
+                       content => template('site/aptrepo.erb'),
                        notify => Exec['apt-get update'],
-               }
-       } else {
-               file { "/etc/apt/sources.list.d/${name}.list":
-                       ensure => $ensure,
-                       source => $config,
-                       notify => Exec['apt-get update'],
-               }
        }
 }
diff --git a/modules/site/templates/aptrepo.erb b/modules/site/templates/aptrepo.erb
new file mode 100644 (file)
index 0000000..a826fa2
--- /dev/null
@@ -0,0 +1,6 @@
+##
+### THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
+### 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').to_a.join(' ') %>