From: Stephen Gran <steve@lobefin.net>
Date: Tue, 17 Apr 2012 19:31:08 +0000 (+0100)
Subject: Revert "simplify site::aptrepo"
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=97b80c63870174dd9ca6e92b04da0f110a8150b3;p=dsa-puppet.git

Revert "simplify site::aptrepo"

This reverts commit 5f7e9b2a528a64883641f38558c028ae4b1967f0.
---

diff --git a/modules/buildd/manifests/init.pp b/modules/buildd/manifests/init.pp
index ab6b05a2..79065a17 100644
--- a/modules/buildd/manifests/init.pp
+++ b/modules/buildd/manifests/init.pp
@@ -23,8 +23,8 @@ class buildd {
 		ensure => absent,
 	}
 	site::aptrepo { 'buildd.debian.org':
-		content => template('buildd/etc/apt/sources.list.d/buildd.list.erb'),
-		key     => 'puppet:///modules/buildd/buildd.debian.org.asc',
+		template => 'buildd/etc/apt/sources.list.d/buildd.list.erb',
+		key      => 'puppet:///modules/buildd/buildd.debian.org.asc',
 	}
 
 	file { '/etc/apt/preferences.d/buildd':
diff --git a/modules/debian-org/manifests/init.pp b/modules/debian-org/manifests/init.pp
index 9da7de53..da54711e 100644
--- a/modules/debian-org/manifests/init.pp
+++ b/modules/debian-org/manifests/init.pp
@@ -62,13 +62,13 @@ class debian-org {
 
 	if $::debarchitecture != 'armhf' {
 		site::aptrepo { 'security':
-			content => template('debian-org/etc/apt/sources.list.d/security.list.erb'),
+			template => 'debian-org/etc/apt/sources.list.d/security.list.erb',
 		}
 		site::aptrepo { 'backports.debian.org':
-			content => template('debian-org/etc/apt/sources.list.d/backports.debian.org.list.erb'),
+			template => 'debian-org/etc/apt/sources.list.d/backports.debian.org.list.erb',
 		}
 		site::aptrepo { 'volatile':
-			content => template('debian-org/etc/apt/sources.list.d/volatile.list.erb'),
+			template => 'debian-org/etc/apt/sources.list.d/volatile.list.erb',
 		}
 	}
 	site::aptrepo { 'backports.org':
@@ -82,8 +82,8 @@ class debian-org {
 	}
 
 	site::aptrepo { 'db.debian.org':
-		content => template('debian-org/etc/apt/sources.list.d/debian.org.list.erb'),
-		key     => 'puppet:///modules/debian-org/db.debian.org.asc',
+		template => 'debian-org/etc/apt/sources.list.d/debian.org.list.erb',
+		key      => 'puppet:///modules/debian-org/db.debian.org.asc',
 	}
 
 	file { '/etc/facter':
diff --git a/modules/debian-org/manifests/proliant.pp b/modules/debian-org/manifests/proliant.pp
index afb6bed5..04b9cdd3 100644
--- a/modules/debian-org/manifests/proliant.pp
+++ b/modules/debian-org/manifests/proliant.pp
@@ -1,7 +1,7 @@
 class debian-org::proliant {
 
 	site::aptrepo { 'debian.restricted':
-		content => template('debian-org/etc/apt/sources.list.d/debian.restricted.list.erb'),
+		template => 'debian-org/etc/apt/sources.list.d/debian.restricted.list.erb',
 	}
 
 	package { 'hpacucli':
@@ -26,3 +26,5 @@ class debian-org::proliant {
 		}
 	}
 }
+
+
diff --git a/modules/megactl/manifests/init.pp b/modules/megactl/manifests/init.pp
index 7dd32afa..3c376639 100644
--- a/modules/megactl/manifests/init.pp
+++ b/modules/megactl/manifests/init.pp
@@ -4,6 +4,6 @@ class megactl {
 	}
 
 	site::aptrepo { 'debian.restricted':
-		content => template('debian-org/etc/apt/sources.list.d/debian.restricted.list.erb'),
+		template => 'debian-org/etc/apt/sources.list.d/debian.restricted.list.erb',
 	}
 }
diff --git a/modules/named/manifests/geodns.pp b/modules/named/manifests/geodns.pp
index 7e3ac019..b12593da 100644
--- a/modules/named/manifests/geodns.pp
+++ b/modules/named/manifests/geodns.pp
@@ -4,7 +4,7 @@ class named::geodns inherits named {
 	}
 
 	site::aptrepo { 'geoip':
-		content => template('debian-org/etc/apt/sources.list.d/geoip.list.erb'),
+		template => 'debian-org/etc/apt/sources.list.d/geoip.list.erb',
 	}
 
 	file { '/etc/bind/':
diff --git a/modules/site/manifests/aptrepo.pp b/modules/site/manifests/aptrepo.pp
index ea1b9202..ae66d6f2 100644
--- a/modules/site/manifests/aptrepo.pp
+++ b/modules/site/manifests/aptrepo.pp
@@ -1,4 +1,5 @@
-define site::aptrepo ($key = undef, $keyid = undef, $content = '', $source = '', $ensure = present) {
+define site::aptrepo ($key = undef, $keyid = undef, $template = undef, $config = undef, $ensure = present) {
+
 
 	case $ensure {
 		present: {
@@ -39,15 +40,22 @@ define site::aptrepo ($key = undef, $keyid = undef, $content = '', $source = '',
 	}
 
 	if $ensure == present {
-		if ! ($source or $content) {
+		if ! ($config or $template) {
 			fail ( "No configuration found for ${name}" )
 		}
 	}
 
-	file { "/etc/apt/sources.list.d/${name}.list":
-		ensure  => $ensure,
-		content => $content,
-		source  => $source,
-		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'],
+		}
 	}
 }