[csw-devel] SF.net SVN: gar:[19721] csw/mgar/pkg/puppet3

phipsy at users.sourceforge.net phipsy at users.sourceforge.net
Tue Nov 20 17:37:19 CET 2012


Revision: 19721
          http://gar.svn.sourceforge.net/gar/?rev=19721&view=rev
Author:   phipsy
Date:     2012-11-20 16:37:19 +0000 (Tue, 20 Nov 2012)
Log Message:
-----------
Import puppet3 working

Added Paths:
-----------
    csw/mgar/pkg/puppet3/Makefile
    csw/mgar/pkg/puppet3/branches/
    csw/mgar/pkg/puppet3/tags/
    csw/mgar/pkg/puppet3/trunk/
    csw/mgar/pkg/puppet3/trunk/Makefile
    csw/mgar/pkg/puppet3/trunk/checksums
    csw/mgar/pkg/puppet3/trunk/files/
    csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.postinstall
    csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.postremove
    csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.preinstall
    csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.preremove
    csw/mgar/pkg/puppet3/trunk/files/README.CSW
    csw/mgar/pkg/puppet3/trunk/files/cswpuppetd
    csw/mgar/pkg/puppet3/trunk/files/cswpuppetmasterd
    csw/mgar/pkg/puppet3/trunk/files/cswusergroup
    csw/mgar/pkg/puppet3/trunk/files/pkgutil.rb
    csw/mgar/pkg/puppet3/trunk/files/puppet.conf.example-CSW
    csw/mgar/pkg/puppet3/trunk/files/puppetd.xml
    csw/mgar/pkg/puppet3/trunk/files/puppetmaster.xml
    csw/mgar/pkg/puppet3/trunk/work/

Added: csw/mgar/pkg/puppet3/Makefile
===================================================================
--- csw/mgar/pkg/puppet3/Makefile	                        (rev 0)
+++ csw/mgar/pkg/puppet3/Makefile	2012-11-20 16:37:19 UTC (rev 19721)
@@ -0,0 +1,15 @@
+# vim: ft=make ts=4 sw=4 noet
+
+default:
+	@echo "You are in the pkg/ directory."
+
+%:
+	$(MAKE) -C trunk $* 
+
+paranoid-%:
+	$(MAKE) -C trunk $* || exit 2 
+
+export BUILDLOG ?= $(shell pwd)/buildlog.txt
+
+report-%:
+	$(MAKE) -C trunk $* || echo "	*** make $* in $$i failed ***" >> $(BUILDLOG) 

Added: csw/mgar/pkg/puppet3/trunk/Makefile
===================================================================
--- csw/mgar/pkg/puppet3/trunk/Makefile	                        (rev 0)
+++ csw/mgar/pkg/puppet3/trunk/Makefile	2012-11-20 16:37:19 UTC (rev 19721)
@@ -0,0 +1,122 @@
+# Copyright 2012 OpenCSW
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+NAME = puppet3
+VERSION = 3.0.1
+GARTYPE = v2
+
+define BLURB
+  Puppet helps accomplish the goal of a hands-off, automated infrastructure.
+  The benefits of automated infrastructure go beyond policy-enforced
+  consistency and auditing.  The impact of hardware failure and other disaster
+  scenarios can be mitigated, as services can be quickly restored by Puppet. In
+  conjunction with virtualizaton, the ability to reliably create new systems
+  running consistent services can be leveraged to create autoscaling
+  applications as well as test systems identical to production environments.
+endef
+
+DISTNAME = puppet-${VERSION}
+MASTER_SITES = http://puppetlabs.com/downloads/puppet/
+DISTFILES  = ${DISTNAME}.tar.gz
+DISTFILES += cswpuppetd
+DISTFILES += cswpuppetmasterd
+DISTFILES += cswusergroup
+DISTFILES += CSWpuppet.postinstall
+DISTFILES += README.CSW
+DISTFILES += puppet.conf.example-CSW
+SPKG_SOURCEURL = http://puppetlabs.com/
+LICENSE_CSWpuppet3 = LICENSE
+LICENSE_CSWpuppetmaster3 = LICENSE
+
+INITSMF += $(sysconfdir)/init\.d/cswpuppetd
+INITSMF += $(sysconfdir)/init\.d/cswpuppetmasterd
+USERGROUP = $(sysconfdir)/pkg/puppet/cswusergroup
+
+# Creating a separate package CSWpuppetmaster so that the cswpuppetmaster
+# service isn't started upon the installation of CSWpuppet.
+PACKAGES += CSWpuppetmaster3
+PACKAGES += CSWpuppet3
+
+INCOMPATIBLE_PKGS += CSWpuppet
+INCOMPATIBLE_PKGS += CSWpuppetmaster
+
+SPKG_DESC_CSWpuppet3       = System configuration management tool, client daemon
+SPKG_DESC_CSWpuppetmaster3 = System configuration management tool, server
+
+RUNTIME_DEP_PKGS                  = CSWfacter
+RUNTIME_DEP_PKGS                  += CSWruby18
+RUNTIME_DEP_PKGS				  += CSWrubyaugeas
+RUNTIME_DEP_PKGS_CSWpuppetmaster3 += CSWpuppet3
+RUNTIME_DEP_PKGS_CSWpuppetmaster3 += CSWruby18
+BUILD_DEP_PKGS  				  = $(RUNTIME_DEP_PKGS)
+
+PKGFILES_CSWpuppetmaster3  = $(sysconfdir)/init\.d/cswpuppetmasterd
+PKGFILES_CSWpuppetmaster3 += $(sbindir)/puppetmasterd
+PKGFILES_CSWpuppetmaster3 += $(mandir)/man8/puppetmasterd.8
+PKGFILES_CSWpuppetmaster3 += $(libdir)/.*/puppet/application/puppetmasterd.rb
+PKGFILES_CSWpuppetmaster3 += $(sysconfdir)/puppet/auth.conf
+
+ARCHALL = 1
+
+sysconfdir     = /etc$(prefix)
+localstatedir  = /var$(prefix)
+rubysitelibdir = $(shell ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
+
+CONFIGURE_SCRIPTS =
+BUILD_SCRIPTS     =
+TEST_SCRIPTS      =
+INSTALL_SCRIPTS   = puppet
+
+CHECKPKG_OVERRIDES_CSWpuppetmaster3  = surplus-dependency|CSWruby18
+CHECKPKG_OVERRIDES_CSWpuppet3        = surplus-dependency|CSWfacter
+CHECKPKG_OVERRIDES_CSWpuppet3	    += surplus-dependency|CSWrubyaugeas
+CHECKPKG_OVERRIDES_CSWpuppet3       += missing-dependency|CSWpython
+# Puppet has hardcoded paths to look at for many OSes, many of which involve
+# /usr/share and /usr/local.
+CHECKPKG_OVERRIDES_CSWpuppet3 	    += file-with-bad-content
+# These files are quite deliberate - without them users will not get CSW
+# behaviour. The README explains
+CHECKPKG_OVERRIDES_CSWpuppet3 	    += bad-location-of-file|file=/etc/puppet
+CHECKPKG_OVERRIDES_CSWpuppet3 	    += bad-location-of-file|file=/etc/puppet/README.CSW
+CHECKPKG_OVERRIDES_CSWpuppet3 	    += bad-location-of-file|file=/etc/puppet/puppet.conf.example-CSW
+# yes, yes, we know it conflicts with puppet{,.asmter} - that's the point of
+# INCOMPATIBLE_PKGS
+CHECKPKG_OVERRIDES_CSWpuppet3 		+= file-collision
+CHECKPKG_OVERRIDES_CSWpuppetmaster3	+= file-collision
+
+include gar/category.mk
+
+install-puppet:
+	ginstall -m 755 -d $(DESTDIR)
+	ginstall -m 755 -d $(DESTDIR)/etc/puppet
+	ginstall -m 644 $(FILEDIR)/README.CSW $(DESTDIR)/etc/puppet/README.CSW
+	ginstall -m 644 $(FILEDIR)/puppet.conf.example-CSW $(DESTDIR)/etc/puppet/puppet.conf.example-CSW
+	ginstall -m 755 -d $(DESTDIR)$(sysconfdir)/puppet
+	ginstall -m 755 -d $(DESTDIR)$(localstatedir)/puppet/run
+	ginstall -m 755 -d $(DESTDIR)$(sysconfdir)/init.d
+	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) && $(INSTALL_ENV) ruby install.rb \
+		--configdir=$(sysconfdir)/puppet \
+		--bindir=$(bindir) \
+		--sbindir=$(sbindir) \
+		--full
+	ginstall -m 755 $(FILEDIR)/pkgutil.rb $(DESTDIR)$(rubysitelibdir)/puppet/provider/package
+	cd $(DESTDIR)$(mandir)/man8 && gunzip *
+	(cd $(WORKSRC)/examples/etc/puppet && \
+	for f in *; do \
+	    if [ -f $$f ] ; then \
+	        cp $$f $(DESTDIR)$(sysconfdir)/puppet/$$f.example; \
+	        chmod 644 $(DESTDIR)$(sysconfdir)/puppet/$$f.example; \
+	    fi; \
+	done)
+	mv $(DESTDIR)$(sysconfdir)/puppet/auth.conf $(DESTDIR)$(sysconfdir)/puppet/auth.conf.example
+	ginstall -m 644 $(FILEDIR)/puppet.conf.example-CSW $(DESTDIR)$(sysconfdir)/puppet/puppet.conf.example
+	ginstall -d -m 755 $(DESTDIR)$(sysconfdir)/pkg/puppet
+	ginstall -m 644 $(FILEDIR)/cswusergroup \
+		$(DESTDIR)$(sysconfdir)/pkg/puppet/cswusergroup
+	mkdir -p $(DESTDIR)$(localstatedir)/lib
+	gunzip $(DESTDIR)$(mandir)/man5/puppet.conf.5.gz
+	@$(MAKECOOKIE)

Added: csw/mgar/pkg/puppet3/trunk/checksums
===================================================================
--- csw/mgar/pkg/puppet3/trunk/checksums	                        (rev 0)
+++ csw/mgar/pkg/puppet3/trunk/checksums	2012-11-20 16:37:19 UTC (rev 19721)
@@ -0,0 +1 @@
+2117e3a1964ac54fcd36d926eed3db94  puppet-3.0.1.tar.gz

Added: csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.postinstall
===================================================================
--- csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.postinstall	                        (rev 0)
+++ csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.postinstall	2012-11-20 16:37:19 UTC (rev 19721)
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# $Id: CSWpuppet.postinstall 14590 2011-05-17 15:47:19Z phipsy $
+#
+
+PKG_INSTALL_ROOT=${PKG_INSTALL_ROOT:-/}
+
+# Migration of the configuration files?
+# 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/chown puppet /var/lib/puppet
+    if [ ! -d $PKG_INSTALL_ROOT/var/opt/csw/puppet ]; then
+        /usr/sbin/chroot $PKG_INSTALL_ROOT /usr/bin/ln -s /var/lib/puppet /var/opt/csw/puppet
+    fi
+fi
+
+if [ ! -d $PKG_INSTALL_ROOT/opt/csw/var/puppet -o ! -L $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
+
+touch $PKG_INSTALL_ROOT/etc/opt/csw/puppet/puppet.conf
+/usr/bin/test -f $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf && . $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf
+/usr/bin/test -f $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf && . $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf
+if [ "$autoenable_daemons" != "no" ] ; then
+    /usr/sbin/chroot $PKG_INSTALL_ROOT /usr/sbin/svccfg import /opt/csw/var/svc/manifest/puppetd.xml || /bin/true
+    /usr/sbin/chroot $PKG_INSTALL_ROOT /usr/sbin/svcadm enable svc:network/puppetd  || /bin/true
+fi

Added: csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.postremove
===================================================================
--- csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.postremove	                        (rev 0)
+++ csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.postremove	2012-11-20 16:37:19 UTC (rev 19721)
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $Id: CSWpuppet.postremove 7387 2009-11-22 23:49:36Z glawsf $
+#
+
+# Not sure if this cleanup is the right thing to do. TODO(maciej): review
+
+rm /etc/puppet || /bin/true
+rmdir /opt/csw/etc/puppet || /bin/true
+rm /var/puppet || /bin/true
+rmdir /opt/csw/var/puppet || /bin/true

Added: csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.preinstall
===================================================================
--- csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.preinstall	                        (rev 0)
+++ csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.preinstall	2012-11-20 16:37:19 UTC (rev 19721)
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# $Id: CSWpuppet.preinstall 6316 2009-09-16 10:56:09Z wahwah $
+#
+
+PKG_INSTALL_ROOT=${PKG_INSTALL_ROOT:-/}
+
+# Replaced with cswusergroup
+
+exit 0
+
+$PKG_INSTALL_ROOT/usr/sbin/chroot $PKG_INSTALL_ROOT/ /usr/bin/getent group puppet \
+    > /dev/null \
+    || /usr/sbin/chroot $PKG_INSTALL_ROOT /usr/sbin/groupadd puppet
+$PKG_INSTALL_ROOT/usr/sbin/chroot $PKG_INSTALL_ROOT/ /usr/bin/getent passwd puppet \
+    > /dev/null \
+    || /usr/sbin/chroot $PKG_INSTALL_ROOT /usr/sbin/useradd -g puppet -c "Puppet" -d /var/opt/csw/puppet -s "/bin/true" puppet
+
+mkdir -p $PKG_INSTALL_ROOT/etc/opt/csw/puppet
+chown root:bin $PKG_INSTALL_ROOT/etc/opt/csw/puppet

Added: csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.preremove
===================================================================
--- csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.preremove	                        (rev 0)
+++ csw/mgar/pkg/puppet3/trunk/files/CSWpuppet.preremove	2012-11-20 16:37:19 UTC (rev 19721)
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $Id: CSWpuppet.preremove 6316 2009-09-16 10:56:09Z wahwah $
+#
+
+# Replaced with INITSMF
+
+exit 0
+
+/usr/sbin/svcadm disable svc:network/puppetd 2>/dev/null || /bin/true
+/usr/sbin/svccfg delete svc:network/puppetd || /bin/true

Added: csw/mgar/pkg/puppet3/trunk/files/README.CSW
===================================================================
--- csw/mgar/pkg/puppet3/trunk/files/README.CSW	                        (rev 0)
+++ csw/mgar/pkg/puppet3/trunk/files/README.CSW	2012-11-20 16:37:19 UTC (rev 19721)
@@ -0,0 +1,14 @@
+README.CSW
+
+Puppet will insist on /etc/puppet and /var/lib/puppet being directories, it's
+no good making them symlinks, Puppet will just change them to actual
+directories - this does not fit with the OpenCSW paths, so in /etc/puppet you
+will find an example skeleton puppet.conf that is designed to make the product
+confirm to our paths. To use the daemon with CSW paths, put the puppet.conf
+examples in /etc/puppet and /etc/opt/csw/puppet into place and start the
+daemon with --confdir=/etc/opt/csw/puppet.
+
+Naturally you're free to discard the examples and use the product's own
+preferred paths. If no puppet.conf is present in /etc/puppet this is how the
+program will behave.
+

Added: csw/mgar/pkg/puppet3/trunk/files/cswpuppetd
===================================================================
--- csw/mgar/pkg/puppet3/trunk/files/cswpuppetd	                        (rev 0)
+++ csw/mgar/pkg/puppet3/trunk/files/cswpuppetd	2012-11-20 16:37:19 UTC (rev 19721)
@@ -0,0 +1,126 @@
+#!/bin/sh
+#
+# $Id: cswpuppetd 17679 2012-04-14 18:58:06Z phipsy $
+#
+# /etc/opt/csw/init.d/cswpuppetd
+#
+#   2011-05-06 Mark Phillips
+#     * Check if we're on Solaris 10 before including the smf_include stuff
+#
+#   2011-03-06 Mark Phillips
+#     * Added getprop - not used, yet
+#
+#   2009-10-21 Maciej Blizinski
+#
+#     * Introduced start/stop/reload as functions
+#     * Distinguishing between reload and restart
+#     * Made the script zone-friendly
+#     * Supported custom pid file locations.
+#
+#   2009-11-23 Gary Law
+#     * changed sbindir
+
+# Check if we're on 10; therefore SMF
+if [ -x /usr/sbin/svcadm ]; then
+    . /lib/svc/share/smf_include.sh
+fi
+
+prefix="/opt/csw"
+exec_prefix="/opt/csw"
+sysconfdir="/etc/opt/csw"
+sbindir="/opt/csw/sbin"
+localstatedir="/var/opt/csw"
+
+getprop() {
+    val=`/usr/bin/svcprop -p $1 $SMF_FMRI`
+    [ -n "$val" ] && echo $val
+}
+
+start_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
+}
+
+stop_puppetd() {
+    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
+}
+
+# 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}"
+}
+
+pidfile=`$prefix/bin/puppet agent --configprint pidfile`
+
+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
+        ;;
+esac
+exit 0
+


Property changes on: csw/mgar/pkg/puppet3/trunk/files/cswpuppetd
___________________________________________________________________
Added: svn:executable
   + 

Added: csw/mgar/pkg/puppet3/trunk/files/cswpuppetmasterd
===================================================================
--- csw/mgar/pkg/puppet3/trunk/files/cswpuppetmasterd	                        (rev 0)
+++ csw/mgar/pkg/puppet3/trunk/files/cswpuppetmasterd	2012-11-20 16:37:19 UTC (rev 19721)
@@ -0,0 +1,76 @@
+#!/bin/sh
+#
+#   2011-05-06 Mark Phillips
+#     * Check if we're on Solaris 10 before including the smf_include stuff
+#
+#   2011-03-06 Mark Phillips
+#     * Added getprop
+#
+#   2009-11-23 Gary Law
+#     * Original version
+
+# Check if we're on 10; therefore SMF
+if [ -x /usr/sbin/svcadm ]; then
+    . /lib/svc/share/smf_include.sh
+fi
+
+prefix=/opt/csw
+exec_prefix=/opt/csw
+sysconfdir=/etc/opt/csw
+sbindir=/opt/csw/sbin
+
+pidfile=`$prefix/bin/puppet master --genconf | awk '/pidfile/ { print $3 }'`
+
+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
+
+    printf " puppetmaster"
+    echo ""
+    ;;
+stop)
+    printf "Stopping Puppet server services:"
+    kill `cat $pidfile`
+
+    printf " puppetmasterd"
+    echo ""
+    ;;
+restart)
+    printf "Restarting Puppet server services:"
+    kill -HUP `cat $pidfile`
+
+    printf " puppetmasterd"
+    echo ""
+    ;;
+reload)
+    printf "Reloading Puppet server services:"
+
+    kill -HUP `cat $pidfile`
+
+	printf " puppetmasterd"
+	echo ""
+    ;;
+status)
+    if [ -f $pidfile ]; then
+        pid=`cat $pidfile`
+        curpid=`pgrep puppetmasterd`
+        if [ "$pid" -eq "$curpid" ]; then
+            exit 0
+        else
+            exit 1
+        fi
+    else
+        exit 1
+    fi
+esac
+exit 0
+


Property changes on: csw/mgar/pkg/puppet3/trunk/files/cswpuppetmasterd
___________________________________________________________________
Added: svn:executable
   + 

Added: csw/mgar/pkg/puppet3/trunk/files/cswusergroup
===================================================================
--- csw/mgar/pkg/puppet3/trunk/files/cswusergroup	                        (rev 0)
+++ csw/mgar/pkg/puppet3/trunk/files/cswusergroup	2012-11-20 16:37:19 UTC (rev 19721)
@@ -0,0 +1 @@
+puppet:puppet:Puppet configuration management:/var/lib/puppet:/bin/false:::NP

Added: csw/mgar/pkg/puppet3/trunk/files/pkgutil.rb
===================================================================
--- csw/mgar/pkg/puppet3/trunk/files/pkgutil.rb	                        (rev 0)
+++ csw/mgar/pkg/puppet3/trunk/files/pkgutil.rb	2012-11-20 16:37:19 UTC (rev 19721)
@@ -0,0 +1,184 @@
+# Packaging using Peter Bonivart's pkgutil program.
+Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun do
+  desc "Package management using Peter Bonivart's ``pkgutil`` command on Solaris."
+
+  pkgutil_bin = "pkgutil"
+  if FileTest.executable?("/opt/csw/bin/pkgutil")
+    pkgutil_bin = "/opt/csw/bin/pkgutil"
+  end
+
+  confine :operatingsystem => :solaris
+
+  commands :pkguti => pkgutil_bin
+
+  def self.healthcheck()
+    unless FileTest.exists?("/var/opt/csw/pkgutil/admin")
+      Puppet.notice "It is highly recommended you create '/var/opt/csw/pkgutil/admin'."
+      Puppet.notice "See /var/opt/csw/pkgutil"
+    end
+
+    correct_wgetopts = false
+    [ "/opt/csw/etc/pkgutil.conf", "/etc/opt/csw/pkgutil.conf" ].each do |confpath|
+      File.open(confpath) do |conf|
+        conf.each_line {|line| correct_wgetopts = true if line =~ /^\s*wgetopts\s*=.*(-nv|-q|--no-verbose|--quiet)/ }
+      end
+    end
+    if ! correct_wgetopts
+      Puppet.notice "It is highly recommended that you set 'wgetopts=-nv' in your pkgutil.conf."
+    end
+  end
+
+  def self.instances(hash = {})
+    healthcheck
+
+    # Use the available pkg list (-a) to work out aliases
+    aliases = {}
+    availlist.each do |pkg|
+      aliases[pkg[:name]] = pkg[:alias]
+    end
+
+    # The -c pkglist lists installed packages
+    pkginsts = []
+    output = pkguti(["-c"])
+    parse_pkglist(output).each do |pkg|
+      pkg.delete(:avail)
+      pkginsts << new(pkg)
+
+      # Create a second instance with the alias if it's different
+      pkgalias = aliases[pkg[:name]]
+      if pkgalias and pkg[:name] != pkgalias
+        apkg = pkg.dup
+        apkg[:name] = pkgalias
+        pkginsts << new(apkg)
+      end
+    end
+
+    pkginsts
+  end
+
+  # Turns a pkgutil -a listing into hashes with the common alias, full
+  # package name and available version
+  def self.availlist
+    output = pkguti ["-a"]
+
+    list = output.split("\n").collect do |line|
+      next if line =~ /^common\s+package/  # header of package list
+      next if noise?(line)
+
+      if line =~ /\s*(\S+)\s+(\S+)\s+(.*)/
+        { :alias => $1, :name => $2, :avail => $3 }
+      else
+        Puppet.warning "Cannot match %s" % line
+      end
+    end.reject { |h| h.nil? }
+  end
+
+  # Turn our pkgutil -c listing into a hash for a single package.
+  def pkgsingle(resource)
+    # The --single option speeds up the execution, because it queries
+    # the package managament system for one package only.
+    command = ["-c", "--single", resource[:name]]
+    self.class.parse_pkglist(run_pkgutil(resource, command), { :justme => resource[:name] })
+  end
+
+  # Turn our pkgutil -c listing into a bunch of hashes.
+  def self.parse_pkglist(output, hash = {})
+    output = output.split("\n")
+
+    if output[-1] == "Not in catalog"
+      Puppet.warning "Package not in pkgutil catalog: %s" % hash[:justme]
+      return nil
+    end
+
+    list = output.collect do |line|
+      next if line =~ /installed\s+catalog/  # header of package list
+      next if noise?(line)
+
+      pkgsplit(line)
+    end.reject { |h| h.nil? }
+
+    if hash[:justme]
+      # Single queries may have been for an alias so return the name requested
+      if list.any?
+        list[-1][:name] = hash[:justme]
+        return list[-1]
+      end
+    else
+      list.reject! { |h| h[:ensure] == :absent }
+      return list
+    end
+  end
+
+  # Identify common types of pkgutil noise as it downloads catalogs etc
+  def self.noise?(line)
+    true if line =~ /^#/
+    true if line =~ /^Checking integrity / # use_gpg
+    true if line =~ /^gpg: /               # gpg verification
+    true if line =~ /^=+> /                # catalog fetch
+    true if line =~ /\d+:\d+:\d+ URL:/     # wget without -q
+    false
+  end
+
+  # Split the different lines into hashes.
+  def self.pkgsplit(line)
+    if line =~ /\s*(\S+)\s+(\S+)\s+(.*)/
+      hash = {}
+      hash[:name] = $1
+      hash[:ensure] = if $2 == "notinst"
+        :absent
+      else
+        $2
+      end
+      hash[:avail] = $3
+
+      if hash[:avail] =~ /^SAME\s*$/
+        hash[:avail] = hash[:ensure]
+      end
+
+      # Use the name method, so it works with subclasses.
+      hash[:provider] = self.name
+
+      return hash
+    else
+      Puppet.warning "Cannot match %s" % line
+      return nil
+    end
+  end
+
+  def run_pkgutil(resource, *args)
+    # Allow source to be one or more URLs pointing to a repository that all
+    # get passed to pkgutil via one or more -t options
+    if resource[:source]
+      sources = [resource[:source]].flatten
+      pkguti *[sources.map{|src| [ "-t", src ]}, *args].flatten
+    else
+      pkguti *args.flatten
+    end
+  end
+
+  def install
+    run_pkgutil @resource, "-y", "-i", @resource[:name]
+  end
+
+  # Retrieve the version from the current package file.
+  def latest
+    hash = pkgsingle(@resource)
+    hash[:avail] if hash
+  end
+
+  def query
+    if hash = pkgsingle(@resource)
+      hash
+    else
+      {:ensure => :absent}
+    end
+  end
+
+  def update
+    run_pkgutil @resource, "-y", "-u", @resource[:name]
+  end
+
+  def uninstall
+    run_pkgutil @resource, "-y", "-r", @resource[:name]
+  end
+end

Added: csw/mgar/pkg/puppet3/trunk/files/puppet.conf.example-CSW
===================================================================
--- csw/mgar/pkg/puppet3/trunk/files/puppet.conf.example-CSW	                        (rev 0)
+++ csw/mgar/pkg/puppet3/trunk/files/puppet.conf.example-CSW	2012-11-20 16:37:19 UTC (rev 19721)
@@ -0,0 +1,9 @@
+# puppet.conf
+#
+# points puppet at OpenCSW default paths
+
+[main]
+    confdir = /etc/opt/csw/puppet
+    config = $confdir/puppet.conf
+    vardir = /var/opt/csw/puppet
+    ssldir = $vardir/ssl

Added: csw/mgar/pkg/puppet3/trunk/files/puppetd.xml
===================================================================
(Binary files differ)


Property changes on: csw/mgar/pkg/puppet3/trunk/files/puppetd.xml
___________________________________________________________________
Added: svn:mime-type
   + application/xml

Added: csw/mgar/pkg/puppet3/trunk/files/puppetmaster.xml
===================================================================
(Binary files differ)


Property changes on: csw/mgar/pkg/puppet3/trunk/files/puppetmaster.xml
___________________________________________________________________
Added: svn:mime-type
   + application/xml

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