[csw-devel] SF.net SVN: gar:[13645] csw/mgar/pkg/puppet/trunk

phipsy at users.sourceforge.net phipsy at users.sourceforge.net
Mon Mar 7 15:20:50 CET 2011


Revision: 13645
          http://gar.svn.sourceforge.net/gar/?rev=13645&view=rev
Author:   phipsy
Date:     2011-03-07 14:20:50 +0000 (Mon, 07 Mar 2011)

Log Message:
-----------
Changes to puppet to cater for inbuilt behaviour

Modified Paths:
--------------
    csw/mgar/pkg/puppet/trunk/Makefile
    csw/mgar/pkg/puppet/trunk/files/CSWpuppet.postinstall
    csw/mgar/pkg/puppet/trunk/files/cswpuppetd
    csw/mgar/pkg/puppet/trunk/files/cswpuppetmasterd

Modified: csw/mgar/pkg/puppet/trunk/Makefile
===================================================================
--- csw/mgar/pkg/puppet/trunk/Makefile	2011-03-07 11:53:02 UTC (rev 13644)
+++ csw/mgar/pkg/puppet/trunk/Makefile	2011-03-07 14:20:50 UTC (rev 13645)
@@ -25,15 +25,11 @@
 DISTFILES += cswpuppetd
 DISTFILES += cswpuppetmasterd
 DISTFILES += cswusergroup
-DISTFILES += puppetd.xml
-DISTFILES += puppetmaster.xml
-UFILES_REGEX = $(NAME)-(\d+(?:\.\d+)*).tar.gz
+DISTFILES += CSWpuppet.postinstall
 SPKG_SOURCEURL = http://puppetlabs.com/
 
 INITSMF += $(sysconfdir)/init\.d/cswpuppetd
 INITSMF += $(sysconfdir)/init\.d/cswpuppetmasterd
-#MANIFEST /var${prefix}/svc/manifest/network/puppetd.xml
-#MANIFEST /var${prefix}/svc/manifest/network/puppetmaster.xml
 USERGROUP = $(sysconfdir)/pkg/puppet/cswusergroup
 
 # Creating a separate package CSWpuppetmaster so that the cswpuppetmaster
@@ -53,7 +49,7 @@
 PKGFILES_CSWpuppetmaster += $(sbindir)/puppetmasterd
 PKGFILES_CSWpuppetmaster += $(mandir)/man8/puppetmasterd.8
 PKGFILES_CSWpuppetmaster += $(libdir)/.*/puppet/application/puppetmasterd.rb
-PKGFILES_CSWpuppetmaster += /var${prefix}/svc/manifest/network/puppetmaster.xml
+PKGFILES_CSWpuppetmaster += $(sysconfdir)/puppet/auth.conf
 
 ARCHALL = 1
 
@@ -70,7 +66,7 @@
 PATCHFILES += 0003-Use-opt-csw-share-puppet-modules-as-default.patch
 
 CHECKPKG_OVERRIDES_CSWpuppet       += surplus-dependency|CSWfacter
-CHECKPKG_OVERRIDES_CSWpuppet += missing-dependency|CSWpython
+CHECKPKG_OVERRIDES_CSWpuppet       += missing-dependency|CSWpython
 CHECKPKG_OVERRIDES_CSWpuppetmaster += surplus-dependency|CSWpuppet
 
 # CRONDIR = $(sysconfdir)/pkg/CSWpuppet/crontabs
@@ -91,12 +87,8 @@
 	ginstall -m 755 $(FILEDIR)/cswpuppetd $(DESTDIR)$(sysconfdir)/init.d
 	ginstall -m 755 $(FILEDIR)/cswpuppetmasterd $(DESTDIR)$(sysconfdir)/init.d
 	ginstall -m 755 $(FILEDIR)/cswpuppetmasterd $(DESTDIR)/etc$(prefix)/init.d
-	(cd $(WORKSRC) && \
-	gsed -e "s|/var/puppet|/var/opt/csw/puppet|g" -i ./lib/puppet/defaults.rb; \
-	gsed -e "s|/etc/puppet|/etc/opt/csw/puppet|g" -i ./lib/puppet/defaults.rb; \
-	gsed -e "s|/var/run/puppet|/var/opt/csw/puppet/run|g" -i ./lib/puppet/defaults.rb)
 	cd $(WORKSRC) && $(INSTALL_ENV) ruby install.rb \
-		--configdir=$(sysconfdir) \
+		--configdir=$(sysconfdir)/puppet \
 		--bindir=$(bindir) \
 		--sbindir=$(sbindir) \
 		--full
@@ -111,13 +103,6 @@
 	ginstall -d -m 755 $(DESTDIR)$(sysconfdir)/pkg/puppet
 	ginstall -m 644 $(FILEDIR)/cswusergroup \
 		$(DESTDIR)$(sysconfdir)/pkg/puppet/cswusergroup
-	( [ -d $(DESTDIR)/var/lib ] && echo "$(DESTDIR)/var/lib" must not exist && false ) || true
+	# ( [ -d $(DESTDIR)/var/lib ] && echo "$(DESTDIR)/var/lib" must not exist && false ) || true
 	mkdir -p $(DESTDIR)$(localstatedir)/lib
-	# For this file to run, CSWpuppet would need to depend on CSWpython,
-	# and we don't want that. It could be split off to another package, but
-	# this file doesn't seem to be of any use on Solaris, so we can safely
-	# remove it.
-	# markp: Putting this back in. Will look at deps later. Some places do run
-	# yum on Solaris, would you believe.
-	# rm $(DESTDIR)$(libdir)/ruby/site_ruby/1.8/puppet/provider/package/yumhelper.py
 	@$(MAKECOOKIE)

Modified: csw/mgar/pkg/puppet/trunk/files/CSWpuppet.postinstall
===================================================================
--- csw/mgar/pkg/puppet/trunk/files/CSWpuppet.postinstall	2011-03-07 11:53:02 UTC (rev 13644)
+++ csw/mgar/pkg/puppet/trunk/files/CSWpuppet.postinstall	2011-03-07 14:20:50 UTC (rev 13645)
@@ -6,11 +6,22 @@
 PKG_INSTALL_ROOT=${PKG_INSTALL_ROOT:-/}
 
 # Migration of the configuration files?
-/usr/bin/test -d $PKG_INSTALL_ROOT/opt/csw/etc/puppet || /usr/sbin/chroot $PKG_INSTALL_ROOT /usr/bin/ln -s /etc/opt/csw/puppet /opt/csw/etc/puppet
-/usr/bin/test -d $PKG_INSTALL_ROOT/etc/puppet || /usr/sbin/chroot $PKG_INSTALL_ROOT /usr/bin/ln -s /opt/csw/etc/puppet /etc/puppet
-/usr/bin/test -d $PKG_INSTALL_ROOT/opt/csw/var/puppet || /usr/sbin/chroot $PKG_INSTALL_ROOT /usr/bin/ln -s /var/opt/csw/puppet /opt/csw/var/puppet
-/usr/bin/test -d $PKG_INSTALL_ROOT/var/puppet || /usr/sbin/chroot $PKG_INSTALL_ROOT /usr/bin/ln -s /var/opt/csw/puppet /var/puppet
+# This is horrible. Puppet insists on it's directories and will FORCE them to
+# _be_ directories. Therefore, to fit in with the CSW layout the only vaguely
+# sensible thing to do is to symlink TO the CSW layout and not FROM it.
+if [ ! -d $PKG_INSTALL_ROOT/opt/csw/etc/puppet ]; then
+    /usr/sbin/chroot $PKG_INSTALL_ROOT /usr/bin/ln -s /etc/opt/csw/puppet /opt/csw/etc/puppet
+fi
 
+if [ ! -d $PKG_INSTALL_ROOT/var/lib ]; then
+    /usr/sbin/chroot $PKG_INSTALL_ROOT /usr/bin/mkdir -p /var/lib/puppet
+    /usr/sbin/chroot $PKG_INSTALL_ROOT /usr/bin/ln -s /var/lib/puppet /var/opt/csw/puppet
+fi
+
+if [ ! -d $PKG_INSTALL_ROOT/opt/csw/var/puppet ]; then 
+    /usr/sbin/chroot $PKG_INSTALL_ROOT /usr/bin/ln -s /var/lib/puppet /opt/csw/var/puppet
+fi
+
 # Replaced with INITSMF
 
 exit 0

Modified: csw/mgar/pkg/puppet/trunk/files/cswpuppetd
===================================================================
--- csw/mgar/pkg/puppet/trunk/files/cswpuppetd	2011-03-07 11:53:02 UTC (rev 13644)
+++ csw/mgar/pkg/puppet/trunk/files/cswpuppetd	2011-03-07 14:20:50 UTC (rev 13645)
@@ -4,6 +4,9 @@
 #
 # /etc/opt/csw/init.d/cswpuppetd
 #
+#   2011-03-06 Mark Phillips
+#     * Added getprop - not used, yet
+#
 #   2009-10-21 Maciej Blizinski
 #
 #     * Introduced start/stop/reload as functions
@@ -22,101 +25,111 @@
 sbindir="/opt/csw/sbin"
 localstatedir="/var/opt/csw"
 
+getprop() {
+    val=`/usr/bin/svcprop -p $1 $SMF_FMRI`
+    [ -n "$val" ] && echo $val
+}
 
 start_puppetd() {
-  cd /
-  # Start daemons.
-  ${sbindir}/puppetd
+    cd /
+    confdir=`getprop puppet/confdir`
+    vardir=`getprop puppet/vardir`
+    ssldir=`getprop puppet/ssldir`
+    
+    # Start daemons.
+    #${sbindir}/puppetd --confdir=$confdir --vardir=$vardir --ssldir=$ssldir
+    ${sbindir}/puppetd
 }
 
 reload_puppetd() {
-  if [ -r $pidfile ]; then
-    kill -HUP `cat $pidfile`
-  fi
+    if [ -r $pidfile ]; then
+        kill -HUP `cat $pidfile`
+    fi
 }
 
 stop_puppetd() {
-  if [ -r $pidfile ]; then
-    pid=`cat $pidfile`
-    kill $pid
-  fi
+    if [ -r $pidfile ]; then
+        pid=`cat $pidfile`
+        kill $pid
+    fi
 }
 
 get_current_pid() {
-  if [ -x /usr/bin/zonename ]; then
-    zone=`/usr/bin/zonename`
-    zoneopts="-z $zone"
-  else
-    zoneopts=""
-  fi
-  pgrep $zoneopts puppetd
+    if [ -x /usr/bin/zonename ]; then
+        zone=`/usr/bin/zonename`
+        zoneopts="-z $zone"
+    else
+        zoneopts=""
+    fi
+    pgrep $zoneopts puppetd
 }
 
 # Returns a line with certain string from a config file.
 get_line_with() {
-  __s="$1"
-  __f="$2"
-  cat "${__f}" \
-    | sed -e 's/^ *//' \
-    | grep -v '^#' \
-    | grep "${__s}"
+    __s="$1"
+    __f="$2"
+    cat "${__f}" \
+        | sed -e 's/^ *//' \
+        | grep -v '^#' \
+        | grep "${__s}"
 }
 
 get_pid_file() {
-  # The default pid file is /var/opt/csw/puppet/run/puppetd.pid
-  # but a different pid file can be set in puppet.conf.
-  __pidfile="/var/opt/csw/puppet/run/puppetd.pid"
-  conffile="/etc/opt/csw/puppet/puppet.conf"
-  if [ -r "$conffile" ]; then
-    pid_line=`get_line_with pidfile ${conffile}`
-    if [ -n "${pid_line}" ]; then
-      echo "${pid_line}" | cut -d= -f2 | tr -d ' '
-      return
+    # The default pid file is /var/opt/csw/puppet/run/puppetd.pid
+    # but a different pid file can be set in puppet.conf.
+    __pidfile="/var/opt/csw/puppet/run/puppetd.pid"
+    conffile="/etc/opt/csw/puppet/puppet.conf"
+    if [ -r "$conffile" ]; then
+        pid_line=`get_line_with pidfile ${conffile}`
+        if [ -n "${pid_line}" ]; then
+            echo "${pid_line}" | cut -d= -f2 | tr -d ' '
+            return
+        fi
     fi
-  fi
-  echo "${__pidfile}"
+    echo "${__pidfile}"
 }
 
 pidfile=`get_pid_file`
 
 case "$1" in
-  start)
-    printf "Starting Puppet client services:"
-    start_puppetd
-    printf " puppetd"
-    echo ""
-    ;;
-  stop)
-    printf "Stopping Puppet client services:"
-    stop_puppetd
-    printf " puppetd"
-    echo ""
-    ;;
-  restart)
-    printf "Restarting Puppet client services:"
-    stop_puppetd
-    start_puppetd
-    printf " puppetd"
-    echo ""
-    ;;
-  reload)
-    printf "Reloading Puppet client services:"
-    reload_puppetd
-    printf " puppetd"
-    echo ""
-    ;;
-  status)
-    if [ -f $pidfile ]; then
-      pid=`cat $pidfile`
-      curpid=`get_current_pid`
-      if [ "$pid" -eq "$curpid" ]; then
-        exit 0
-      else
-        exit 1
-      fi
-    else
-      exit 1
-    fi
-    ;;
+    start)
+        printf "Starting Puppet client services:"
+        start_puppetd
+        printf " puppetd"
+        echo ""
+        ;;
+    stop)
+        printf "Stopping Puppet client services:"
+        stop_puppetd
+        printf " puppetd"
+        echo ""
+        ;;
+    restart)
+        printf "Restarting Puppet client services:"
+        stop_puppetd
+        start_puppetd
+        printf " puppetd"
+        echo ""
+        ;;
+    reload)
+        printf "Reloading Puppet client services:"
+        reload_puppetd
+        printf " puppetd"
+        echo ""
+        ;;
+    status)
+        if [ -f $pidfile ]; then
+            pid=`cat $pidfile`
+            curpid=`get_current_pid`
+            if [ "$pid" -eq "$curpid" ]; then
+                exit 0
+            else
+                exit 1
+            fi
+        else
+            exit 1
+        fi
+        ;;
 esac
 exit 0
+

Modified: csw/mgar/pkg/puppet/trunk/files/cswpuppetmasterd
===================================================================
--- csw/mgar/pkg/puppet/trunk/files/cswpuppetmasterd	2011-03-07 11:53:02 UTC (rev 13644)
+++ csw/mgar/pkg/puppet/trunk/files/cswpuppetmasterd	2011-03-07 14:20:50 UTC (rev 13645)
@@ -1,5 +1,10 @@
 #!/bin/sh
 #
+#   2011-03-06 Mark Phillips
+#     * Added getprop
+#
+#   2009-11-23 Gary Law
+#     * Original version
 
 . /lib/svc/share/smf_include.sh
 
@@ -10,15 +15,19 @@
 
 pidfile=/var/opt/csw/puppet/run/puppetmasterd.pid
 
+getprop() {
+    val=`/usr/bin/svcprop -p $1 $SMF_FMRI`
+    [ -n "$val" ] && echo $val
+}
+
 case "$1" in
 start)
     cd /
     # Start daemons.
 
     printf "Starting Puppet server services:"
+    ${sbindir}/puppetmasterd
 
-    /opt/csw/sbin/puppetmasterd
-
     printf " puppetmaster"
     echo ""
     ;;
@@ -59,4 +68,3 @@
 esac
 exit 0
 
-# $Id$


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list