[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

James Turnbull james at lovedthanlost.net
Fri Jan 23 14:21:27 UTC 2009


The following commit has been merged in the master branch:
commit b53509b4538cf581d2d306b43c11f729ba9a2568
Author: James Turnbull <james at lovedthanlost.net>
Date:   Tue Oct 21 10:37:56 2008 +1100

    Fixed #1460 - enhance redhat puppetmaster init.d script to easy start puppetmaster as a mongrel cluster

diff --git a/CHANGELOG b/CHANGELOG
index 1046384..d247fd2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 0.24.6
+    Fixed #1460 - enhance redhat puppetmaster init.d script to easy start puppetmaster as a mongrel cluster
+
     Fixed #1663 - Regression relating to facter fact naming from 0.24.5
 
     Fixed #1655 - Provider::Confine::Variable tests are broken
diff --git a/conf/redhat/server.init b/conf/redhat/server.init
index 8266977..6871b9a 100644
--- a/conf/redhat/server.init
+++ b/conf/redhat/server.init
@@ -1,7 +1,8 @@
 #!/bin/bash
 # puppetmaster  This shell script enables the puppetmaster server.
 #
-# Author:       Duane Griffin <d.griffin at psenterprise.com>
+# Authors:       Duane Griffin <d.griffin at psenterprise.com>
+#                Peter Meier <peter.meier at immerda.ch> (Mongrel enhancements)
 #
 # chkconfig: - 65 45
 #
@@ -22,6 +23,11 @@ fi
 
 PUPPETMASTER_OPTS=""
 [ -n "$PUPPETMASTER_MANIFEST" ] && PUPPETMASTER_OPTS="--manifest=${PUPPETMASTER_MANIFEST}"
+if [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -gt 1 ]; then
+    PUPPETMASTER_OPTS="$PUPPETMASTER_OPTS --servertype=mongrel"
+elif [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -eq 1 ]; then
+    PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} --masterport=${PUPPETMASTER_PORTS[0]}" 
+fi
 [ -n "$PUPPETMASTER_LOG" ] && PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} --logdest=${PUPPETMASTER_LOG}"
 PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} \
 	${PUPPETMASTER_EXTRA_OPTS}"
@@ -36,8 +42,16 @@ start() {
 
 	# Confirm the manifest exists
 	if [ -r $PUPPETMASTER_MANIFEST ]; then
-		daemon $PUPPETMASTER $PUPPETMASTER_OPTS
-		RETVAL=$?
+        if [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -gt 1 ]; then
+            for ((i=0; i<${#PUPPETMASTER_PORTS[@]}; i++)); do
+                echo -en "\nPort: ${PUPPETMASTER_PORTS[$i]}"
+                daemon $PUPPETMASTER $PUPPETMASTER_OPTS --masterport=${PUPPETMASTER_PORTS[$i]} --pidfile=/var/run/puppet/puppetmaster.${PUPPETMASTER_PORTS[$i]}.pid
+                ret=$?; [ $ret != 0 ] && RETVAL=$ret
+            done
+        else
+            daemon $PUPPETMASTER $PUPPETMASTER_OPTS
+            RETVAL=$?
+        fi
 	else
 		failure $"Manifest does not exist: $PUPPETMASTER_MANIFEST"
 		echo
@@ -50,8 +64,16 @@ start() {
 
 stop() {
 	echo -n  $"Stopping puppetmaster: "
-	killproc $PUPPETMASTER
-	RETVAL=$?
+    if [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -gt 1 ]; then
+        for ((i=0; i<${#PUPPETMASTER_PORTS[@]}; i++)); do
+            echo -en "\nPort: ${PUPPETMASTER_PORTS[$i]}"
+            killproc -p /var/run/puppet/puppetmaster.${PUPPETMASTER_PORTS[$i]}.pid puppetmaster 
+            ret=$?; [ $ret != 0 ] && RETVAL=$ret
+        done
+    else
+       killproc $PUPPETMASTER
+       RETVAL=$?
+    fi
 	echo
 	[ $RETVAL -eq 0 ] && rm -f "$lockfile"
 	return $RETVAL
@@ -67,6 +89,20 @@ genconfig() {
   $PUPPETMASTER $PUPPETMASTER_OPTS --genconfig
 }
 
+puppetmaster_status() {
+    if [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -gt 1 ]; then
+        for ((i=0; i<${#PUPPETMASTER_PORTS[@]}; i++)); do
+            echo -en "Port ${PUPPETMASTER_PORTS[$i]}: "
+            status -p /var/run/puppet/puppetmaster.${PUPPETMASTER_PORTS[$i]}.pid puppetmaster 
+            ret=$?; [ $ret != 0 ] && RETVAL=$ret
+        done 
+    else
+	    status $PUPPETMASTER
+        RETVAL=$?
+    fi
+    return $RETVAL
+}
+
 case "$1" in
   start)
 	start
@@ -81,8 +117,7 @@ case "$1" in
 	[ -f "$lockfile" ] && restart
 	;;
   status)
-	status $PUPPETMASTER
-        RETVAL=$?
+    puppetmaster_status
 	;;
   genconfig)
 	genconfig
diff --git a/conf/redhat/server.sysconfig b/conf/redhat/server.sysconfig
index fe673cc..befb40f 100644
--- a/conf/redhat/server.sysconfig
+++ b/conf/redhat/server.sysconfig
@@ -5,5 +5,27 @@
 # Specify syslog to send log messages to the system log.
 #PUPPETMASTER_LOG=syslog
 
+# You may specify an alternate port or an array of ports on which 
+# puppetmaster should listen. Default is: 8140
+# If you specify more than one port, the puppetmaster ist automatically
+# started with the servertype set to mongrel. This might be interesting
+# if you'd like to run your puppetmaster in a loadbalanced cluster.
+# Please note: this won't setup nor start any loadbalancer. 
+# If you'd like to run puppetmaster with mongrel as servertype but only
+# on one (specified) port, you have to add --servertype=mongrel to
+# PUPPETMASTER_EXTRA_OPTS.
+# Default: Empty (Puppetmaster isn't started with mongrel, nor on a 
+# specific port)
+#
+# Please note: Due to reduced options in the rc-functions lib in RHEL/Centos
+# versions prior to 5, this feature won't work. Fedora versions >= 8 are 
+# known to work.
+#PUPPETMASTER_PORTS=""
+# Puppetmaster on a different port, run with standard webrick servertype
+#PUPPETMASTER_PORTS="8141"
+# Example with multiple ports which will start puppetmaster with mongrel
+# as a servertype
+#PUPPETMASTER_PORTS=( 18140 18141 18142 18143 )
+
 # You may specify other parameters to the puppetmaster here
 #PUPPETMASTER_EXTRA_OPTS=--noca

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list