From c51538102d1644c3cd9ec3c21267109f72ea922b Mon Sep 17 00:00:00 2001
From: Monty Taylor <mordred@inaugust.com>
Date: Sun, 8 Apr 2012 09:22:16 -0700
Subject: [PATCH] Move email addresses of sysadmins to paramater.

When we put these all in by default, then people testing things or people
who aren't even us get the mail on their systems configured to email us.
Change-Id: Ib9d4160e0c81151bf040422c89621bc0fcefcd66
---
 manifests/site.pp                                     | 8 +++++++-
 manifests/stackforge.pp                               | 9 +++++++--
 modules/exim/manifests/init.pp                        | 4 ++--
 modules/exim/{files/aliases => templates/aliases.erb} | 9 +++++----
 4 files changed, 21 insertions(+), 9 deletions(-)
 rename modules/exim/{files/aliases => templates/aliases.erb} (55%)

diff --git a/manifests/site.pp b/manifests/site.pp
index 5ea086f82c..ac44a991f6 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -7,7 +7,7 @@ class openstack_base ($iptables_public_tcp_ports) {
   include openstack_project::users
   include ssh
   include snmpd
-  include exim
+
   include sudoers
 
   class { 'iptables':
@@ -72,6 +72,12 @@ class openstack_server ($iptables_public_tcp_ports) {
   class { 'openstack_template':
     iptables_public_tcp_ports => $iptables_public_tcp_ports
   }
+  class { 'exim':
+    sysadmin => ['corvus@inaugust.com',
+                 'mordred@inaugust.com',
+                 'andrew@linuxjedi.co.uk',
+                 'devananda.vdv@gmail.com']
+  }
   include openstack_cron
 }
 
diff --git a/manifests/stackforge.pp b/manifests/stackforge.pp
index 5fd55a0f85..58f3635f39 100644
--- a/manifests/stackforge.pp
+++ b/manifests/stackforge.pp
@@ -7,7 +7,6 @@ class openstack_base ($iptables_public_tcp_ports) {
   include openstack_project::users
   include ssh
   include snmpd
-  include exim
   include sudoers
 
   class { 'iptables':
@@ -63,6 +62,12 @@ class openstack_server ($iptables_public_tcp_ports) {
   class { 'openstack_template':
     iptables_public_tcp_ports => $iptables_public_tcp_ports
   }
+  class { 'exim':
+    sysadmin => ['corvus@inaugust.com',
+                 'mordred@inaugust.com',
+                 'andrew@linuxjedi.co.uk',
+                 'devananda.vdv@gmail.com']
+  }
 }
 
 class openstack_jenkins_slave {
@@ -79,7 +84,7 @@ class openstack_jenkins_slave {
 #
 
 node default {
-  class { 'openstack_server':
+  class { 'openstack_template':
     iptables_public_tcp_ports => []
   }
 }
diff --git a/modules/exim/manifests/init.pp b/modules/exim/manifests/init.pp
index 8290b1437e..dc2803a548 100644
--- a/modules/exim/manifests/init.pp
+++ b/modules/exim/manifests/init.pp
@@ -1,4 +1,4 @@
-class exim() {
+class exim($sysadmin=[]) {
   package { 'exim4-base':
     ensure => present;
   }
@@ -30,7 +30,7 @@ class exim() {
     group => 'root',
     mode => 444,
     ensure => 'present',
-    source => 'puppet:///modules/exim/aliases',
+    content => template("exim/aliases.erb"),
     replace => 'true',
   }
 }
diff --git a/modules/exim/files/aliases b/modules/exim/templates/aliases.erb
similarity index 55%
rename from modules/exim/files/aliases
rename to modules/exim/templates/aliases.erb
index 03e2f5f66e..d3204c8619 100644
--- a/modules/exim/files/aliases
+++ b/modules/exim/templates/aliases.erb
@@ -12,7 +12,8 @@ abuse: root
 noc: root
 security: root
 
-sysadmin: corvus@inaugust.com, mordred@inaugust.com, andrew@linuxjedi.co.uk, devananda.vdv@gmail.com
-root: sysadmin
-gerrit2: sysadmin
-jenkins: sysadmin
+gerrit2: root
+jenkins: root
+<% if sysadmin.length > 0 -%>
+root: <%= sysadmin.join(",") %>
+<% end -%>