[Lsb-messages] /var/www/bzr/lsb/devel/puppet-lsb r30: Add script for enabling auto-update of puppet config.

Jeff Licquia licquia at linuxfoundation.org
Sun Jan 22 19:49:32 UTC 2012


------------------------------------------------------------
revno: 30
committer: Jeff Licquia <licquia at linuxfoundation.org>
branch nick: puppet-lsb
timestamp: Sun 2012-01-22 14:49:32 -0500
message:
  Add script for enabling auto-update of puppet config.
added:
  modules/puppet/files/puppet-email-notify
modified:
  modules/puppet/manifests/server.pp
-------------- next part --------------
=== added file 'modules/puppet/files/puppet-email-notify'
--- a/modules/puppet/files/puppet-email-notify	1970-01-01 00:00:00 +0000
+++ b/modules/puppet/files/puppet-email-notify	2012-01-22 19:49:32 +0000
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# puppet-email-notify - script to update puppet config on notification
+#                       from a commit mailing list
+
+# Configuration
+
+# List-Id for the mailing list, escaped properly for use in a regex
+NOTIFY_LIST_ID=lsb-messages.lists.linux-foundation.org
+
+# Subject content to search for (usually a repository name)
+# Also escaped properly for use in a regex.
+NOTIFY_SUBJECT=lsb/devel/puppet-lsb
+
+# Command to gain root for the update
+ROOT_CMD=sudo
+
+# Version control command to use for the update
+VC_UPDATE="bzr update -q"
+
+# End of configuration
+
+found_list_id=no
+found_subject=no
+
+while read email_line; do
+    if [ $(echo $email_line | egrep "^List-Id:.*$NOTIFY_LIST_ID" | wc -l) -gt 0 ]; then
+        found_list_id=yes
+    fi
+    if [ $(echo $email_line | egrep "^Subject:.*$NOTIFY_SUBJECT" | wc -l) -gt 0 ]; then
+        found_subject=yes
+    fi
+done
+
+if [ $found_list_id = "yes" -a $found_subject = "yes" ]; then
+    cd /etc/puppet
+    $ROOT_CMD $VC_UPDATE
+fi
+
+exit 0

=== modified file 'modules/puppet/manifests/server.pp'
--- a/modules/puppet/manifests/server.pp	2012-01-22 19:07:47 +0000
+++ b/modules/puppet/manifests/server.pp	2012-01-22 19:49:32 +0000
@@ -7,4 +7,11 @@
     # with the default client file.
     File['puppet.conf'] { source => undef }
 
+    # Config auto-update, based on email notifications.
+
+    file { '/usr/local/bin/puppet-email-notify':
+        source => [ "puppet:///modules/puppet/puppet-email-notify" ],
+        mode => 0755,
+    }
+
 }



More information about the lsb-messages mailing list