initial
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 78
|
||||
/dav/ikwadmin/!svn/ver/4431/linux/puppetmaster/etc_puppet/modules/puppet/files
|
||||
END
|
||||
org.macports.puppet.plist
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 104
|
||||
/dav/ikwadmin/!svn/ver/3270/linux/puppetmaster/etc_puppet/modules/puppet/files/org.macports.puppet.plist
|
||||
END
|
||||
puppetd_run.sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 93
|
||||
/dav/ikwadmin/!svn/ver/2714/linux/puppetmaster/etc_puppet/modules/puppet/files/puppetd_run.sh
|
||||
END
|
||||
@@ -1,105 +0,0 @@
|
||||
10
|
||||
|
||||
dir
|
||||
4547
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin/linux/puppetmaster/etc_puppet/modules/puppet/files
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin
|
||||
|
||||
|
||||
|
||||
2011-06-21T11:23:42.358929Z
|
||||
4431
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0e4a7186-e024-0410-a49b-aced43e0d94e
|
||||
|
||||
debian
|
||||
dir
|
||||
|
||||
ganglia
|
||||
dir
|
||||
|
||||
darwin
|
||||
dir
|
||||
|
||||
org.macports.puppet.plist
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
de69fc6f4e6821a12a6d81e8859d1b8d
|
||||
2010-03-26T16:47:49.726793Z
|
||||
3270
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
661
|
||||
|
||||
puppetd_run.sh
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
0a43d883ca09d2a9eef11f4ff209cf07
|
||||
2009-08-01T09:52:05.172762Z
|
||||
2714
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1426
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,9 +0,0 @@
|
||||
K 14
|
||||
svn:executable
|
||||
V 1
|
||||
*
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
|
||||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
|
||||
<plist version='1.0'>
|
||||
<dict>
|
||||
<key>Label</key><string>org.macports.puppet</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/opt/local/bin/daemondo</string>
|
||||
<string>--label=puppet</string>
|
||||
<string>--start-cmd</string>
|
||||
<string>/opt/local/sbin/puppetd</string>
|
||||
<string>--no-daemonize</string>
|
||||
<string>--verbose</string>
|
||||
<string>;</string>
|
||||
<string>--pid=exec</string>
|
||||
</array>
|
||||
<key>Debug</key><false/>
|
||||
<key>Disabled</key><true/>
|
||||
<key>OnDemand</key><false/>
|
||||
<key>RunAtLoad</key><true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# $Id$
|
||||
|
||||
|
||||
# a wrapper script, to run puppetd after a random time
|
||||
# this will be called by cron at the same time on each client,
|
||||
# but should not call the master at the same time as the others.
|
||||
export FACTERLIB="/var/lib/puppet/facts"
|
||||
PATH=/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
PUPPET=$(which puppetd)
|
||||
ISUNIIP=$(ifconfig |grep -c -e "131\.173\.3[2345]")
|
||||
|
||||
if [ ${ISUNIIP} -gt 0 ]; then
|
||||
if [ -e ${PUPPET} ]; then
|
||||
#mac os X laptop check
|
||||
if [ -e /usr/bin/pmset ]; then
|
||||
if [ $(/usr/bin/pmset -g batt | grep -c "Battery Power") -eq 1 ]; then
|
||||
#we are running on battery and do not want to do anything
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
#Linux laptop check
|
||||
if [ -e /proc/acpi/ac_adapter/AC/state ]; then
|
||||
if [ $(grep -c "on-line" /proc/acpi/ac_adapter/AC/state) -eq 0 ]; then
|
||||
#we are running on battery and do not want to do anything
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
MAXSLEEP=3200 #How many seconds to wait maximally
|
||||
SLEEP=${RANDOM}
|
||||
I=${RANDOM}
|
||||
|
||||
# $RANDOM must be called several times, to ensure it really
|
||||
# is something like random
|
||||
for x in 1 2 3 4 5 6 7 8 9 10 11 12; do
|
||||
SLEEP=${RANDOM}
|
||||
done
|
||||
# wait maximally $MAXSLEEP seconds
|
||||
sleep $(expr ${SLEEP} % ${MAXSLEEP})
|
||||
# run puppetd
|
||||
nice -n 12 $PUPPET -t 2&>/var/log/puppet/puppetd_run.log
|
||||
fi
|
||||
fi
|
||||
@@ -1,17 +0,0 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 85
|
||||
/dav/ikwadmin/!svn/ver/2973/linux/puppetmaster/etc_puppet/modules/puppet/files/darwin
|
||||
END
|
||||
mac_inst_pkg.sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 101
|
||||
/dav/ikwadmin/!svn/ver/1786/linux/puppetmaster/etc_puppet/modules/puppet/files/darwin/mac_inst_pkg.sh
|
||||
END
|
||||
chplist.rb
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 96
|
||||
/dav/ikwadmin/!svn/ver/1786/linux/puppetmaster/etc_puppet/modules/puppet/files/darwin/chplist.rb
|
||||
END
|
||||
@@ -1,96 +0,0 @@
|
||||
10
|
||||
|
||||
dir
|
||||
4547
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin/linux/puppetmaster/etc_puppet/modules/puppet/files/darwin
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin
|
||||
|
||||
|
||||
|
||||
2009-11-17T13:03:47.348980Z
|
||||
2973
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0e4a7186-e024-0410-a49b-aced43e0d94e
|
||||
|
||||
mac_inst_pkg.sh
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
044606cd03adeddf802414d297e88313
|
||||
2008-05-12T14:55:08.810767Z
|
||||
1299
|
||||
admin
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2082
|
||||
|
||||
chplist.rb
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
acee173df6f801ba44cd2c8b54d8421a
|
||||
2008-05-12T14:55:08.810767Z
|
||||
1299
|
||||
admin
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
3419
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
K 14
|
||||
svn:executable
|
||||
V 1
|
||||
*
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,5 +0,0 @@
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,148 +0,0 @@
|
||||
#!/usr/bin/env ruby -w
|
||||
# $Id$
|
||||
|
||||
|
||||
require 'rubygems'
|
||||
require 'plist'
|
||||
|
||||
class Plwrap
|
||||
attr_accessor :pl
|
||||
attr_accessor :filename
|
||||
attr_accessor :binary
|
||||
attr_accessor :do_conversion
|
||||
|
||||
def initialize(fn)
|
||||
do_conversion = true
|
||||
@filename = fn
|
||||
if ! File.exists?(fn)
|
||||
@pl = Plist::parse_xml(Hash.new.to_plist)
|
||||
return
|
||||
end
|
||||
|
||||
@binary = false
|
||||
ret = %x{file #{fn}}
|
||||
if ret =~ /binary|data/
|
||||
if do_conversion
|
||||
@binary = true
|
||||
%x{plutil -convert xml1 #{fn}}
|
||||
else
|
||||
raise "I'm not allowed to convert binary plist"
|
||||
end
|
||||
end
|
||||
@pl = Plist::parse_xml(@filename)
|
||||
end
|
||||
def get(key,path=nil)
|
||||
if(!path and get_without_path_ok?(key))
|
||||
path = guesspath(key)
|
||||
end
|
||||
mpath = modpath(path)
|
||||
return eval("@pl" + mpath)
|
||||
end
|
||||
def typeof(key,path=nil)
|
||||
return self.get(key,path).class
|
||||
end
|
||||
def set(key, val, klass=nil, path=nil)
|
||||
begin
|
||||
if(!path and get_without_path_ok?(key))
|
||||
path = guesspath(key)
|
||||
end
|
||||
rescue Exception => e
|
||||
if e.message =~ /oo many/
|
||||
raise e
|
||||
end
|
||||
path = key
|
||||
end
|
||||
mpath = modpath(path)
|
||||
mpath = "[\"#{key}\"]" if !mpath
|
||||
return eval("@pl" + mpath + "= convert(val,key,klass,path)")
|
||||
end
|
||||
def modpath(p)
|
||||
return p.split("::").map{|a| '["' + a + '"]'}.join("") if p
|
||||
end
|
||||
def guesspath(key,base=@pl)
|
||||
raise "base is not set in guesspath" if !base
|
||||
base.each do |a,b|
|
||||
if key == a
|
||||
return a
|
||||
end
|
||||
if b.methods.include?("each")
|
||||
if x = guesspath(key,b)
|
||||
x = a + "::" + x
|
||||
return x
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
def set_without_path_ok?(key)
|
||||
num = num_of_keys_with_this_name(@pl,key)
|
||||
if num > 1
|
||||
raise "Too many occurences of #{key} in tree (#{num} times)"
|
||||
end
|
||||
return true
|
||||
end
|
||||
def get_without_path_ok?(key)
|
||||
num = num_of_keys_with_this_name(@pl,key)
|
||||
if num == 0
|
||||
raise "Key #{key} does not exist"
|
||||
elsif num > 1
|
||||
raise "Too many occurences of #{key} in tree (#{num} times)"
|
||||
end
|
||||
return true
|
||||
end
|
||||
def num_of_keys_with_this_name(base, key)
|
||||
sum = 0
|
||||
raise "base is not set in num_of_keys_with_this_name" if !base
|
||||
base.each do |a,b|
|
||||
sum += 1 if key == a
|
||||
if b.methods.include?("each")
|
||||
sum += num_of_keys_with_this_name(b,key)
|
||||
end
|
||||
end
|
||||
return sum
|
||||
end
|
||||
def write(fn = @filename)
|
||||
Plist::Emit::save_plist(@pl, fn)
|
||||
%x{plutil -convert binary1 #{fn}} if do_conversion and @binary
|
||||
end
|
||||
def convert(val,key=nil,klass=nil,path=nil)
|
||||
if !klass
|
||||
raise ArgumentError, "Key needed if klass not given" if !key
|
||||
if get_without_path_ok?(key)
|
||||
klass = typeof(key,path)
|
||||
end
|
||||
end
|
||||
case klass.to_s
|
||||
when "Boolean"; return ["true","1"].include?(val)
|
||||
when "TrueClass"; return ["true","1"].include?(val)
|
||||
when "FalseClass"; return ["true","1"].include?(val)
|
||||
when "Array"; return val.split("::")
|
||||
when "Hash"; raise "Conversion of hashes not yet implemented"
|
||||
when "String"; return val.to_s
|
||||
when "Integer"; return val.to_i
|
||||
when "Fixnum"; return val.to_i
|
||||
when "Float"; return val.to_f
|
||||
else raise "Unknown class #{klass}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if ARGV.size < 4
|
||||
puts "Usage: $0 file key path val klass\n"
|
||||
exit 1
|
||||
end
|
||||
|
||||
file,key,path,val,klass = ARGV
|
||||
|
||||
|
||||
klass = nil if ["","nil"].include?(klass)
|
||||
path = nil if ["","nil"].include?(path)
|
||||
|
||||
pw = Plwrap.new file
|
||||
begin
|
||||
pw.set(key,val,klass,path)
|
||||
rescue Exception => e
|
||||
puts e.message
|
||||
exit 0
|
||||
end
|
||||
pw.write(file)
|
||||
@@ -1,93 +0,0 @@
|
||||
#!/bin/bash
|
||||
# $Id$
|
||||
|
||||
|
||||
BASEURL=$1
|
||||
VERSION=$2
|
||||
PKGNAME=$3
|
||||
CHKSUM=$4
|
||||
EXTENSION=$5
|
||||
REMOVE=$6
|
||||
CHECKONLY=$7
|
||||
|
||||
# this is the naming scheme of the packages:
|
||||
PKGNS="${PKGNAME}_${VERSION}.${EXTENSION}"
|
||||
|
||||
# ZIPFILE
|
||||
ZIPFILE="${PKGNS}.zip"
|
||||
|
||||
# ------------------------------ Functions ----------------------------
|
||||
|
||||
function is_installed_with_any_version {
|
||||
if [ "`ls \"/Library/Receipts/${PGKNS}\"* 2>/dev/null`" != "" ] ; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function is_installed_with_req_version {
|
||||
## echo "Testing whether /Library/Receipts/${PKGNS} exists"
|
||||
if [ -e "/Library/Receipts/${PKGNS}" ] ; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function remove_old {
|
||||
echo "Removing old not yet implemented!"
|
||||
}
|
||||
|
||||
# ------------------------------ Installed? ---------------------------
|
||||
|
||||
is_installed_with_req_version
|
||||
if [ $? -eq 1 ] ; then
|
||||
echo "Required Version of ${PKGNAME} (${PKGNS}) already installed --> Done."
|
||||
exit 1;
|
||||
fi
|
||||
if [ "$CHECKONLY" != "" ] ; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
is_installed_with_any_version
|
||||
if [ $? -eq 1 ] ; then
|
||||
echo "Other Version of ${PKGNAME} already installed --> Updating."
|
||||
if [ "$REMOVE" == "true" ] ; then
|
||||
remove_old
|
||||
fi
|
||||
else
|
||||
echo "No Version of ${PKGNAME} already installed --> Installing."
|
||||
fi
|
||||
|
||||
# ------------------------------ Download ----------------------------
|
||||
cd /tmp
|
||||
ZIPFILE=`echo $ZIPFILE | perl -npe 's/ /%20/g'`
|
||||
curl "${BASEURL}/$ZIPFILE" -o "/tmp/$ZIPFILE"
|
||||
|
||||
# ------------------------------ Checksum ----------------------------
|
||||
if [ -e "/sw/bin/md5sum" ] ; then
|
||||
DLMD5=`/sw/bin/md5sum "$ZIPFILE" | cut -f1 -d' '`
|
||||
else
|
||||
DLMD5=`md5 "$ZIPFILE" | cut -f4 -d' '`
|
||||
fi
|
||||
|
||||
if [ "0" != "$CHKSUM" ] ; then
|
||||
if [ "$DLMD5" != "$CHKSUM" ] ; then
|
||||
echo "Could not verify checksum: Mismatch!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "WARNING: Ignoring checksum check"
|
||||
fi
|
||||
|
||||
# ------------------------------ Install ----------------------------
|
||||
# -o: force overwrite
|
||||
unzip -o "$ZIPFILE"
|
||||
if installer -pkg "${PKGNS}" -target / ; then
|
||||
touch "/Library/Receipts/${PKGNS}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Installer failed."
|
||||
exit 1
|
||||
@@ -1,11 +0,0 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 85
|
||||
/dav/ikwadmin/!svn/ver/3239/linux/puppetmaster/etc_puppet/modules/puppet/files/debian
|
||||
END
|
||||
puppetqd
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 94
|
||||
/dav/ikwadmin/!svn/ver/3239/linux/puppetmaster/etc_puppet/modules/puppet/files/debian/puppetqd
|
||||
END
|
||||
@@ -1,62 +0,0 @@
|
||||
10
|
||||
|
||||
dir
|
||||
4547
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin/linux/puppetmaster/etc_puppet/modules/puppet/files/debian
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin
|
||||
|
||||
|
||||
|
||||
2010-03-16T19:42:00.406592Z
|
||||
3239
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0e4a7186-e024-0410-a49b-aced43e0d94e
|
||||
|
||||
puppetqd
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
84deb07a79b9344f9d3b4f8399984293
|
||||
2010-03-16T19:42:00.406592Z
|
||||
3239
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
4136
|
||||
|
||||
@@ -1,154 +0,0 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: puppetqd
|
||||
# Required-Start: $network stompserver
|
||||
# Required-Stop: $network
|
||||
# X-Start-Before: apache2 puppetmaster
|
||||
# X-Stop-After: apache2 puppetmaster
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Puppetqd start script
|
||||
# Description: The puppet queue daemon startup script. It queues
|
||||
# placed in /etc/init.d.
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Udo Waechter <udo.waechter@uni-osnabrueck.de>
|
||||
#
|
||||
# Do NOT "set -e"
|
||||
|
||||
# PATH should only include /usr/* if it runs after the mountnfs.sh script
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC="Puppet Queue daemon"
|
||||
NAME=puppetqd
|
||||
DAEMON=/usr/sbin/$NAME
|
||||
DAEMON_ARGS=""
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
|
||||
# Exit if the package is not installed
|
||||
[ -x "$DAEMON" ] || exit 0
|
||||
|
||||
# Read configuration variable file if it is present
|
||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||
|
||||
# Load the VERBOSE setting and other rcS variables
|
||||
. /lib/init/vars.sh
|
||||
|
||||
# Define LSB log_* functions.
|
||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
#
|
||||
# Function that starts the daemon/service
|
||||
#
|
||||
do_start()
|
||||
{
|
||||
# Return
|
||||
# 0 if daemon has been started
|
||||
# 1 if daemon was already running
|
||||
# 2 if daemon could not be started
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|
||||
|| return 1
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
|
||||
$DAEMON_ARGS \
|
||||
|| return 2
|
||||
# Add code here, if necessary, that waits for the process to be ready
|
||||
# to handle requests from services started subsequently which depend
|
||||
# on this one. As a last resort, sleep for some time.
|
||||
}
|
||||
|
||||
#
|
||||
# Function that stops the daemon/service
|
||||
#
|
||||
do_stop()
|
||||
{
|
||||
# Return
|
||||
# 0 if daemon has been stopped
|
||||
# 1 if daemon was already stopped
|
||||
# 2 if daemon could not be stopped
|
||||
# other if a failure occurred
|
||||
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
|
||||
RETVAL="$?"
|
||||
[ "$RETVAL" = 2 ] && return 2
|
||||
# Wait for children to finish too if this is a daemon that forks
|
||||
# and if the daemon is only ever run from this initscript.
|
||||
# If the above conditions are not satisfied then add some other code
|
||||
# that waits for the process to drop all resources that could be
|
||||
# needed by services started subsequently. A last resort is to
|
||||
# sleep for some time.
|
||||
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
|
||||
[ "$?" = 2 ] && return 2
|
||||
# Many daemons don't delete their pidfiles when they exit.
|
||||
rm -f $PIDFILE
|
||||
return "$RETVAL"
|
||||
}
|
||||
|
||||
#
|
||||
# Function that sends a SIGHUP to the daemon/service
|
||||
#
|
||||
do_reload() {
|
||||
#
|
||||
# If the daemon can reload its configuration without
|
||||
# restarting (for example, when it is sent a SIGHUP),
|
||||
# then implement that here.
|
||||
#
|
||||
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
||||
do_start
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
#reload|force-reload)
|
||||
#
|
||||
# If do_reload() is not implemented then leave this commented out
|
||||
# and leave 'force-reload' as an alias for 'restart'.
|
||||
#
|
||||
#log_daemon_msg "Reloading $DESC" "$NAME"
|
||||
#do_reload
|
||||
#log_end_msg $?
|
||||
#;;
|
||||
restart|force-reload)
|
||||
#
|
||||
# If the "reload" option is implemented then remove the
|
||||
# 'force-reload' alias
|
||||
#
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1)
|
||||
do_start
|
||||
case "$?" in
|
||||
0) log_end_msg 0 ;;
|
||||
1) log_end_msg 1 ;; # Old process is still running
|
||||
*) log_end_msg 1 ;; # Failed to start
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
# Failed to stop
|
||||
log_end_msg 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
|
||||
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
:
|
||||
@@ -1,23 +0,0 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 86
|
||||
/dav/ikwadmin/!svn/ver/4431/linux/puppetmaster/etc_puppet/modules/puppet/files/ganglia
|
||||
END
|
||||
puppetd_lastrun.sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 105
|
||||
/dav/ikwadmin/!svn/ver/2810/linux/puppetmaster/etc_puppet/modules/puppet/files/ganglia/puppetd_lastrun.sh
|
||||
END
|
||||
puppetmaster_compiletime.rb
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 114
|
||||
/dav/ikwadmin/!svn/ver/4431/linux/puppetmaster/etc_puppet/modules/puppet/files/ganglia/puppetmaster_compiletime.rb
|
||||
END
|
||||
puppetmaster.rb
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 102
|
||||
/dav/ikwadmin/!svn/ver/2789/linux/puppetmaster/etc_puppet/modules/puppet/files/ganglia/puppetmaster.rb
|
||||
END
|
||||
@@ -1,130 +0,0 @@
|
||||
10
|
||||
|
||||
dir
|
||||
4547
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin/linux/puppetmaster/etc_puppet/modules/puppet/files/ganglia
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin
|
||||
|
||||
|
||||
|
||||
2011-06-21T11:23:42.358929Z
|
||||
4431
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0e4a7186-e024-0410-a49b-aced43e0d94e
|
||||
|
||||
puppetd_lastrun.sh
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
24ae44e38ab4cb360f1ab69e1079fc4b
|
||||
2009-09-02T08:37:05.052250Z
|
||||
2810
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
615
|
||||
|
||||
puppetmaster_compiletime.rb
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
39f9ddaa47fe615ef7fa28c4cb3d1421
|
||||
2011-06-21T11:23:42.358929Z
|
||||
4431
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
945
|
||||
|
||||
puppetmaster.rb
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
90a0e7478ba23139ac01859e649158b6
|
||||
2009-08-29T13:48:55.793923Z
|
||||
2789
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2204
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,5 +0,0 @@
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,9 +0,0 @@
|
||||
K 14
|
||||
svn:executable
|
||||
V 1
|
||||
*
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# $Id$
|
||||
|
||||
# plot puppetd last run
|
||||
|
||||
GMETRIC=$(which gmetric)
|
||||
[[ -x ${GMETRIC} ]] || exit 0
|
||||
|
||||
FILE="/var/lib/puppet/state/state.yaml"
|
||||
[[ -r $FILE ]] || exit 0
|
||||
## BSD and Linux have different stat commands
|
||||
if [ $(uname -s) == "Linux" ]; then
|
||||
STIME=$(stat --format="%Y" ${FILE})
|
||||
else
|
||||
STIME=$(stat -f "%m" -t "%s" ${FILE})
|
||||
fi
|
||||
|
||||
NOW=$(date +"%s")
|
||||
GMETRIC="${GMETRIC} --dmax=30000 --tmax=300 --slope=positive --units=lastrun --type=int32"
|
||||
VALUE=$[ ( ${NOW} - ${STIME} ) / 60 ]
|
||||
$GMETRIC --value=${VALUE} --name="Minutes since last Puppet run"
|
||||
@@ -1,72 +0,0 @@
|
||||
#! /bin/env ruby
|
||||
|
||||
# returns the mem usage of a given process
|
||||
$gmetric = %x{which gmetric}.chomp
|
||||
exit 0 unless $gmetric != ""
|
||||
|
||||
def plist(psname)
|
||||
whats = ["rss","size","vsize","cpu"]
|
||||
%x{ps h -o rss,size,vsize,pcpu,command -C ruby1.8 |grep #{psname}|cut -f 1-4 -d ' '}.each do |ps|
|
||||
#rss,size,vsize,cpu,command = ps.split
|
||||
counter = 0
|
||||
ps.split.each { |value|
|
||||
what = whats[counter]
|
||||
counter += 1
|
||||
units = counter == 4 ? "time" : "kbyte"
|
||||
# puts "#{psname}_#{counter}_#{what} V=#{value} U=#{units}"
|
||||
gmetric("#{psname}_#{counter}_#{what}",value,units)
|
||||
}
|
||||
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
def gmetric(name,value,units)
|
||||
%x{#{$gmetric} --type=float --units=#{units} --name=#{name} --value=#{value} --slope=positive --tmax=300 --dmax=300000}
|
||||
end
|
||||
|
||||
# reports how many clients compiled in the last 5 minutes
|
||||
# repotrs how many unique clients compiled since the begining of the day
|
||||
# report the average compilation time for all clients in the last 5 minutes.
|
||||
def phaselog
|
||||
logfile = ENV['puppet_logfile'] || '/var/log/daemon.log'
|
||||
count,avg,day_count_unique,day_count = 0 ,0 ,0, 0
|
||||
t = Time.now
|
||||
today = t.strftime("^%b %d")
|
||||
hour = t.strftime("%H:")
|
||||
m = t.min.to_i
|
||||
last5m = ""
|
||||
6.times do |i|
|
||||
last5m += hour
|
||||
last5m += "0" if (m-i) < 10
|
||||
last5m += (m-i).to_s
|
||||
last5m += "|" unless i==5
|
||||
end
|
||||
hosts = Array.new
|
||||
regexp = ".* for (.*) in (.*) seconds"
|
||||
File.open(logfile).grep(/#{today}/).grep(/Compiled configuration|Compiled catalog/).each do |line|
|
||||
case line
|
||||
when /#{last5m}/ then
|
||||
if line =~ /#{regexp}/
|
||||
avg += $2.to_f
|
||||
count += 1
|
||||
unless hosts.include?($1)
|
||||
hosts << $1
|
||||
end
|
||||
end
|
||||
when /#{regexp}/ then
|
||||
day_count += 1
|
||||
unless hosts.include?($1)
|
||||
hosts << $1
|
||||
day_count_unique += 1
|
||||
end
|
||||
end
|
||||
end
|
||||
gmetric("puppetmasterd avg_compile",(avg / count).to_s[0..3],"seconds") unless count == 0
|
||||
gmetric("puppetmasterd last5m_count",count,"clients")
|
||||
gmetric("puppetmasterd last24h_unique_count", day_count_unique, "clients")
|
||||
end
|
||||
|
||||
plist("puppetmasterd")
|
||||
gmetric("puppetmasterd known_clients",Dir.entries('/var/lib/puppet/yaml/facts/').size-2,"clients")
|
||||
phaselog
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
# $Id$
|
||||
|
||||
# returns the mem usage of a given process
|
||||
gmetric = %x{which gmetric}.chomp
|
||||
exit 0 unless gmetric != ""
|
||||
gmetric = "#{gmetric} --type=float --units=seconds --slope=positive --tmax=3600 --dmax=300000"
|
||||
debug = ARGV[0].nil? ? false : true
|
||||
test = debug ? "-t ": ""
|
||||
puts "DEBUG" if debug
|
||||
vals = %x{logtail2 #{test}/var/log/daemon.log |awk '/puppet-master.*Compiled catalog for/ {print $14}'|sort -n}.chomp.split(/\n/).collect { |v| v.to_f }
|
||||
puts vals if debug
|
||||
if vals.length > 0
|
||||
min = vals[0]
|
||||
max = vals[-1]
|
||||
mean = sprintf("%.2f",(vals.inject(0) { |r,v| r += v } / vals.length))
|
||||
out = %x{#{gmetric} --name="puppetmaster MIN compile time" --value=#{min}}
|
||||
out += %x{#{gmetric} --name="puppetmaster MAX compile time" --value=#{max}}
|
||||
out += %x{#{gmetric} --name="puppetmaster MEAN compile time" --value=#{mean}}
|
||||
puts out if debug
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 76
|
||||
/dav/ikwadmin/!svn/ver/3237/linux/puppetmaster/etc_puppet/modules/puppet/lib
|
||||
END
|
||||
@@ -1,5 +0,0 @@
|
||||
K 13
|
||||
svn:mergeinfo
|
||||
V 0
|
||||
|
||||
END
|
||||
@@ -1,31 +0,0 @@
|
||||
10
|
||||
|
||||
dir
|
||||
4547
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin/linux/puppetmaster/etc_puppet/modules/puppet/lib
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin
|
||||
|
||||
|
||||
|
||||
2010-03-16T19:29:02.716218Z
|
||||
3237
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0e4a7186-e024-0410-a49b-aced43e0d94e
|
||||
|
||||
puppet
|
||||
dir
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 83
|
||||
/dav/ikwadmin/!svn/ver/3237/linux/puppetmaster/etc_puppet/modules/puppet/lib/puppet
|
||||
END
|
||||
@@ -1,31 +0,0 @@
|
||||
10
|
||||
|
||||
dir
|
||||
4547
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin/linux/puppetmaster/etc_puppet/modules/puppet/lib/puppet
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin
|
||||
|
||||
|
||||
|
||||
2010-03-16T19:29:02.716218Z
|
||||
3237
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0e4a7186-e024-0410-a49b-aced43e0d94e
|
||||
|
||||
provider
|
||||
dir
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 92
|
||||
/dav/ikwadmin/!svn/ver/3237/linux/puppetmaster/etc_puppet/modules/puppet/lib/puppet/provider
|
||||
END
|
||||
@@ -1,5 +0,0 @@
|
||||
K 13
|
||||
svn:mergeinfo
|
||||
V 0
|
||||
|
||||
END
|
||||
@@ -1,31 +0,0 @@
|
||||
10
|
||||
|
||||
dir
|
||||
4547
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin/linux/puppetmaster/etc_puppet/modules/puppet/lib/puppet/provider
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin
|
||||
|
||||
|
||||
|
||||
2010-03-16T19:29:02.716218Z
|
||||
3237
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0e4a7186-e024-0410-a49b-aced43e0d94e
|
||||
|
||||
package
|
||||
dir
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 100
|
||||
/dav/ikwadmin/!svn/ver/3237/linux/puppetmaster/etc_puppet/modules/puppet/lib/puppet/provider/package
|
||||
END
|
||||
appdmg.rb
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 110
|
||||
/dav/ikwadmin/!svn/ver/3225/linux/puppetmaster/etc_puppet/modules/puppet/lib/puppet/provider/package/appdmg.rb
|
||||
END
|
||||
darwinport.rb
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 114
|
||||
/dav/ikwadmin/!svn/ver/3237/linux/puppetmaster/etc_puppet/modules/puppet/lib/puppet/provider/package/darwinport.rb
|
||||
END
|
||||
pkgdmg.rb
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 110
|
||||
/dav/ikwadmin/!svn/ver/3225/linux/puppetmaster/etc_puppet/modules/puppet/lib/puppet/provider/package/pkgdmg.rb
|
||||
END
|
||||
quicklookdmg.rb
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 116
|
||||
/dav/ikwadmin/!svn/ver/3225/linux/puppetmaster/etc_puppet/modules/puppet/lib/puppet/provider/package/quicklookdmg.rb
|
||||
END
|
||||
@@ -1,164 +0,0 @@
|
||||
10
|
||||
|
||||
dir
|
||||
4547
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin/linux/puppetmaster/etc_puppet/modules/puppet/lib/puppet/provider/package
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin
|
||||
|
||||
|
||||
|
||||
2010-03-16T19:29:02.716218Z
|
||||
3237
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0e4a7186-e024-0410-a49b-aced43e0d94e
|
||||
|
||||
appdmg.rb
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
f269e8c848553074841c3c30c324e925
|
||||
2010-01-09T16:41:25.857914Z
|
||||
3088
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
5400
|
||||
|
||||
darwinport.rb
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
a57b6d1d992da46eaec8bf3d4201a0a4
|
||||
2010-03-16T19:29:02.716218Z
|
||||
3237
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2171
|
||||
|
||||
pkgdmg.rb
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
be3953165d2f4ee83733b928d4a3b5e1
|
||||
2009-11-20T14:38:14.959911Z
|
||||
2995
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
5433
|
||||
|
||||
quicklookdmg.rb
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
75ba7bb1a662b468163d07d01c0e4644
|
||||
2009-11-20T14:38:14.959911Z
|
||||
2995
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
5686
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,5 +0,0 @@
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,155 +0,0 @@
|
||||
# Jeff McCune <mccune.jeff@gmail.com>
|
||||
# Changed to app.dmg by: Udo Waechter <udo.waechter@uni-osnabrueck.de>
|
||||
# Mac OS X Package Installer which handles application (.app)
|
||||
# bundles inside an Apple Disk Image.
|
||||
#
|
||||
# Motivation: DMG files provide a true HFS file system
|
||||
# and are easier to manage.
|
||||
#
|
||||
# Note: the 'apple' Provider checks for the package name
|
||||
# in /L/Receipts. Since we possibly install multiple apps's from
|
||||
# a single source, we treat the source .app.dmg file as the package name.
|
||||
# As a result, we store installed .app.dmg file names
|
||||
# in /var/db/.puppet_appdmg_installed_<name>
|
||||
|
||||
require 'puppet/provider/package'
|
||||
require 'yaml'
|
||||
require "fileutils"
|
||||
|
||||
Puppet::Type.type(:package).provide(:appdmg, :parent => Puppet::Provider::Package) do
|
||||
desc "Package management which copies application bundles to a target."
|
||||
$appdmg_target = "/Applications/_IKW"
|
||||
confine :operatingsystem => :darwin
|
||||
|
||||
commands :hdiutil => "/usr/bin/hdiutil"
|
||||
commands :curl => "/usr/bin/curl"
|
||||
commands :rsync => "/usr/bin/rsync"
|
||||
commands :ditto => "/usr/bin/ditto"
|
||||
# JJM We store a cookie for each installed .app.dmg in /var/db
|
||||
def self.instances_by_name
|
||||
Dir.entries("/var/db").find_all { |f|
|
||||
f =~ /^\.puppet_appdmg_installed_/
|
||||
}.collect do |f|
|
||||
name = f.sub(/^\.puppet_appdmg_installed_/, '')
|
||||
yield name if block_given?
|
||||
name
|
||||
end
|
||||
end
|
||||
|
||||
def self.instances
|
||||
instances_by_name.collect do |name|
|
||||
new(:name => name, :provider => :appdmg, :ensure => :installed)
|
||||
end
|
||||
end
|
||||
|
||||
def self.installapp(source, name, orig_source)
|
||||
appname = File.basename(source);
|
||||
if Facter.value(:macosx_productversion_major).to_f < 10.4 #ditto for 10.3 and lower.
|
||||
#remove the .app first, it internal structure might have changed
|
||||
if File.exists?("#{appdpmg_target}/#{appname}")
|
||||
FileUtils.remove_entry_secure("#{$appdmg_target}/#{appname}")
|
||||
end
|
||||
ditto "--rsrc", source, "#{$appdmg_target}/#{appname}"
|
||||
else #rsync deletes files if the source has changed (good for >=10.4)
|
||||
rsync "--delete", "-a","-C", source, "#{$appdmg_target}/"
|
||||
end
|
||||
dbfile = "/var/db/.puppet_appdmg_installed_#{name}.yaml"
|
||||
receipthash = {}
|
||||
receipthash["files"] = []
|
||||
if File.exist?(dbfile)
|
||||
receipthash = YAML::load_file(dbfile)
|
||||
end
|
||||
receipthash["name"] = name
|
||||
receipthash["source"] = orig_source
|
||||
receipthash["files"].include?(appname) or receipthash["files"].push(appname)
|
||||
f = File.open(dbfile,"w")
|
||||
f.print receipthash.to_yaml
|
||||
f.close
|
||||
end
|
||||
|
||||
def self.uninstallappdmg(name)
|
||||
dbfile = "/var/db/.puppet_appdmg_installed_#{name}.yaml"
|
||||
unless File.exist?(dbfile)
|
||||
raise Puppet::Error.new("App DMG Package #{name} not installed.")
|
||||
end
|
||||
receipthash = YAML::load_file(dbfile)
|
||||
receipthash["files"].each do |appname|
|
||||
FileUtils.remove_entry_secure("#{$appdmg_target}/#{appname}")
|
||||
unless $? == 0
|
||||
raise Puppet::Error.new("App DMG could not remove \"#{$appdmg_target}/#{appname}\"")
|
||||
end
|
||||
end
|
||||
File.unlink(dbfile)
|
||||
end
|
||||
|
||||
def self.installappdmg(source, name)
|
||||
unless source =~ /\.dmg$/i
|
||||
raise Puppet::Error.new("Mac OS X app DMG's must specificy a source string ending in .dmg")
|
||||
end
|
||||
require 'open-uri'
|
||||
require 'facter/util/plist'
|
||||
cached_source = source
|
||||
if %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ cached_source
|
||||
cached_source = "/tmp/#{name}"
|
||||
begin
|
||||
curl "-o", cached_source, "-C", "-", "-k", "-s", "--url", source
|
||||
Puppet.debug "Success: curl transfered [#{name}]"
|
||||
rescue Puppet::ExecutionFailure
|
||||
Puppet.debug "curl did not transfer [#{name}]. Falling back to slower open-uri transfer methods."
|
||||
cached_source = source
|
||||
end
|
||||
end
|
||||
|
||||
begin
|
||||
open(cached_source) do |dmg|
|
||||
xml_str = hdiutil "mount", "-plist", "-nobrowse", "-readonly", "-mountrandom", "/tmp", dmg.path
|
||||
ptable = Plist::parse_xml xml_str
|
||||
# JJM Filter out all mount-paths into a single array, discard the rest.
|
||||
mounts = ptable['system-entities'].collect { |entity|
|
||||
entity['mount-point']
|
||||
}.select { |mountloc|; mountloc }
|
||||
begin
|
||||
mounts.each do |fspath|
|
||||
Dir.entries(fspath).select { |f|
|
||||
f =~ /\.app$/i
|
||||
}.each do |app|
|
||||
installapp("#{fspath}/#{app}", name, source)
|
||||
end
|
||||
end # mounts.each do
|
||||
ensure
|
||||
hdiutil "eject", mounts[0]
|
||||
end # begin
|
||||
end # open() do
|
||||
ensure
|
||||
# JJM Remove the file if open-uri didn't already do so.
|
||||
File.unlink(cached_source) if File.exist?(cached_source)
|
||||
end # begin
|
||||
end # def self.installappdmg
|
||||
|
||||
def query
|
||||
if FileTest.exists?("/var/db/.puppet_appdmg_installed_#{@resource[:name]}.yaml")
|
||||
return {:name => @resource[:name], :ensure => :present}
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
def install
|
||||
source = nil
|
||||
unless source = @resource[:source]
|
||||
raise Puppet::Error.new("Mac OS X app DMG's must specify a package source.")
|
||||
end
|
||||
unless name = @resource[:name]
|
||||
raise Puppet::Error.new("Mac OS X app DMG's must specify a package name.")
|
||||
end
|
||||
self.class.installappdmg(source,name)
|
||||
end
|
||||
|
||||
def uninstall
|
||||
unless name = @resource[:name]
|
||||
raise Puppet::Error.new("Mac OS X app DMG's must specify a package name.")
|
||||
end
|
||||
self.class.uninstallappdmg(name)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
require 'puppet/provider/package'
|
||||
|
||||
Puppet::Type.type(:package).provide :darwinport, :parent => Puppet::Provider::Package do
|
||||
desc "Package management using DarwinPorts on OS X."
|
||||
|
||||
confine :operatingsystem => :darwin
|
||||
commands :port => "/opt/local/bin/port"
|
||||
|
||||
def self.eachpkgashash
|
||||
# list out all of the packages
|
||||
open("| #{command(:port)} list installed") { |process|
|
||||
regex = %r{(\S+)\s+@(\S+)\s+(\S+)}
|
||||
fields = [:name, :ensure, :location]
|
||||
hash = {}
|
||||
|
||||
# now turn each returned line into a package object
|
||||
process.each { |line|
|
||||
hash.clear
|
||||
|
||||
if match = regex.match(line)
|
||||
fields.zip(match.captures) { |field,value|
|
||||
hash[field] = value
|
||||
}
|
||||
|
||||
hash.delete :location
|
||||
hash[:provider] = self.name
|
||||
yield hash.dup
|
||||
else
|
||||
raise Puppet::DevError,
|
||||
"Failed to match dpkg line %s" % line
|
||||
end
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def self.instances
|
||||
packages = []
|
||||
|
||||
eachpkgashash do |hash|
|
||||
packages << new(hash)
|
||||
end
|
||||
|
||||
return packages
|
||||
end
|
||||
|
||||
def install
|
||||
should = @resource.should(:ensure)
|
||||
|
||||
# Seems like you can always say 'upgrade'
|
||||
output = port "install", @resource[:name]
|
||||
if output =~ /^Error: No port/
|
||||
raise Puppet::ExecutionFailure, "Could not find package %s" % @resource[:name]
|
||||
end
|
||||
end
|
||||
|
||||
def query
|
||||
version = nil
|
||||
self.class.eachpkgashash do |hash|
|
||||
if hash[:name] == @resource[:name]
|
||||
return hash
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
def latest
|
||||
info = port :search, "^#{@resource[:name]}$"
|
||||
|
||||
if $? != 0 or info =~ /^Error/
|
||||
return nil
|
||||
end
|
||||
|
||||
ary = info.split(/\s+/)
|
||||
version = ary[2].sub(/^@/, '')
|
||||
|
||||
return version
|
||||
end
|
||||
|
||||
def uninstall
|
||||
port :uninstall, @resource[:name]
|
||||
end
|
||||
|
||||
def update
|
||||
return install()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
#
|
||||
# pkgdmg.rb
|
||||
#
|
||||
# Install Installer.app packages wrapped up inside a DMG image file.
|
||||
#
|
||||
# Copyright (C) 2007 Jeff McCune Jeff McCune <jeff@northstarlabs.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation (version 2 of the License)
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston MA 02110-1301 USA
|
||||
#
|
||||
# Motivation: DMG files provide a true HFS file system
|
||||
# and are easier to manage and .pkg bundles.
|
||||
#
|
||||
# Note: the 'apple' Provider checks for the package name
|
||||
# in /L/Receipts. Since we install multiple pkg's from a single
|
||||
# source, we treat the source .pkg.dmg file as the package name.
|
||||
# As a result, we store installed .pkg.dmg file names
|
||||
# in /var/db/.puppet_pkgdmg_installed_<name>
|
||||
|
||||
require 'puppet/provider/package'
|
||||
|
||||
Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Package do
|
||||
desc "Package management based on Apple's Installer.app and DiskUtility.app. This package works by checking the contents of a DMG image for Apple pkg or mpkg files. Any number of pkg or mpkg files may exist in the root directory of the DMG file system. Sub directories are not checked for packages. See `the wiki docs </trac/puppet/wiki/DmgPackages>` for more detail."
|
||||
|
||||
confine :exists => "/Library/Receipts"
|
||||
commands :installer => "/usr/sbin/installer"
|
||||
commands :hdiutil => "/usr/bin/hdiutil"
|
||||
commands :curl => "/usr/bin/curl"
|
||||
# JJM We store a cookie for each installed .pkg.dmg in /var/db
|
||||
def self.instance_by_name
|
||||
Dir.entries("/var/db").find_all { |f|
|
||||
f =~ /^\.puppet_pkgdmg_installed_/
|
||||
}.collect do |f|
|
||||
name = f.sub(/^\.puppet_pkgdmg_installed_/, '')
|
||||
yield name if block_given?
|
||||
name
|
||||
end
|
||||
end
|
||||
|
||||
def self.instances
|
||||
instance_by_name.collect do |name|
|
||||
new(
|
||||
:name => name,
|
||||
:provider => :pkgdmg,
|
||||
:ensure => :installed
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def self.installpkg(source, name, orig_source)
|
||||
installer "-pkg", source, "-target", "/"
|
||||
# Non-zero exit status will throw an exception.
|
||||
File.open("/var/db/.puppet_pkgdmg_installed_#{name}", "w") do |t|
|
||||
t.print "name: '#{name}'\n"
|
||||
t.print "source: '#{orig_source}'\n"
|
||||
end
|
||||
end
|
||||
|
||||
def self.installpkgdmg(source, name)
|
||||
unless source =~ /\.dmg$/i
|
||||
self.fail "Mac OS X PKG DMG's must specificy a source string ending in .dmg"
|
||||
end
|
||||
require 'open-uri'
|
||||
require 'facter/util/plist'
|
||||
cached_source = source
|
||||
if %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ cached_source
|
||||
cached_source = "/tmp/#{name}"
|
||||
begin
|
||||
curl "-o", cached_source, "-C", "-", "-k", "-s", "--url", source
|
||||
Puppet.debug "Success: curl transfered [#{name}]"
|
||||
rescue Puppet::ExecutionFailure
|
||||
Puppet.debug "curl did not transfer [#{name}]. Falling back to slower open-uri transfer methods."
|
||||
cached_source = source
|
||||
end
|
||||
end
|
||||
|
||||
begin
|
||||
open(cached_source) do |dmg|
|
||||
xml_str = hdiutil "mount", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", "/tmp", dmg.path
|
||||
# JJM THIS IS A HORRIBLE HACK (Well, actually it's not so bad...)
|
||||
# mounts = xml_str.scan(/<string>(\/tmp.*?)<\/string>/)[0]
|
||||
ptable = Plist::parse_xml xml_str
|
||||
# JJM Filter out all mount-paths into a single array, discard the rest.
|
||||
mounts = ptable['system-entities'].collect { |entity|
|
||||
entity['mount-point']
|
||||
}.select { |mountloc|; mountloc }
|
||||
begin
|
||||
mounts.each do |fspath|
|
||||
Dir.entries(fspath).select { |f|
|
||||
f =~ /\.m{0,1}pkg$/i
|
||||
}.each do |pkg|
|
||||
installpkg("#{fspath}/#{pkg}", name, source)
|
||||
end
|
||||
end # mounts.each do
|
||||
ensure
|
||||
hdiutil "eject", mounts[0]
|
||||
end # begin
|
||||
end # open() do
|
||||
ensure
|
||||
# JJM Remove the file if open-uri didn't already do so.
|
||||
File.unlink(cached_source) if File.exist?(cached_source)
|
||||
end # begin
|
||||
end # def self.installpkgdmg
|
||||
|
||||
def query
|
||||
if FileTest.exists?("/var/db/.puppet_pkgdmg_installed_#{@resource[:name]}")
|
||||
return {:name => @resource[:name], :ensure => :present}
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
def install
|
||||
source = nil
|
||||
unless source = @resource[:source]
|
||||
self.fail "Mac OS X PKG DMG's must specify a package source."
|
||||
end
|
||||
unless name = @resource[:name]
|
||||
self.fail "Mac OS X PKG DMG's must specify a package name."
|
||||
end
|
||||
self.class.installpkgdmg(source,name)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,149 +0,0 @@
|
||||
# Udo Waechter <root@zoide.net>
|
||||
# Mac OS X QuickLook plugin provider installes quicklook plugins
|
||||
#
|
||||
# Motivation: DMG files provide a true HFS file system
|
||||
# and are easier to manage.
|
||||
#
|
||||
# Note: the 'apple' Provider checks for the package name
|
||||
# in /L/Receipts. Since we possibly install multiple plugins from
|
||||
# a single source, we treat the source .dmg file as the package name.
|
||||
# As a result, we store installed .dmg file names
|
||||
# in /var/db/.puppet_quicklookdmg_installed_<name>
|
||||
|
||||
require 'puppet/provider/package'
|
||||
require 'yaml'
|
||||
require 'fileutils'
|
||||
|
||||
Puppet::Type.type(:package).provide(:quicklookdmg, :parent => Puppet::Provider::Package) do
|
||||
desc "Package management which copies application bundles to a target."
|
||||
$quicklookdmg_target = "/Library/QuickLook"
|
||||
confine :operatingsystem => :darwin
|
||||
|
||||
commands :hdiutil => "/usr/bin/hdiutil"
|
||||
commands :curl => "/usr/bin/curl"
|
||||
commands :ditto => "/usr/bin/ditto"
|
||||
commands :qlmanage => "/usr/bin/qlmanage"
|
||||
# Save information about installed plugins in /var/db
|
||||
def self.instances_by_name
|
||||
Dir.entries("/var/db").find_all { |f|
|
||||
f =~ /^\.puppet_quicklook_installed_/
|
||||
}.collect do |f|
|
||||
name = f.sub(/^\.puppet_quicklook_installed_/, '')
|
||||
yield name if block_given?
|
||||
name
|
||||
end
|
||||
end
|
||||
|
||||
def self.instances
|
||||
instances_by_name.collect do |name|
|
||||
new(:name => name, :provider => :quicklookdmg, :ensure => :installed)
|
||||
end
|
||||
end
|
||||
|
||||
def self.installapp(source, name, orig_source)
|
||||
appname = File.basename(source);
|
||||
FileUtils.rm_rf "#{$quicklookdmg_target}/#{appname}"
|
||||
ditto "--rsrc", source, "#{$quicklookdmg_target}/#{appname}"
|
||||
dbfile = "/var/db/.puppet_quicklook_installed_#{name}.yaml"
|
||||
receipthash = {}
|
||||
receipthash["files"] = []
|
||||
if File.exist?(dbfile)
|
||||
receipthash = YAML::load_file(dbfile)
|
||||
end
|
||||
receipthash["name"] = name
|
||||
receipthash["source"] = orig_source
|
||||
receipthash["files"].include?(appname) or receipthash["files"].push(appname)
|
||||
f = File.open(dbfile,"w")
|
||||
f.print receipthash.to_yaml
|
||||
f.close
|
||||
# refresh plugins
|
||||
qlmanage "-r"
|
||||
end
|
||||
|
||||
def self.uninstallquicklookdmg(name)
|
||||
dbfile = "/var/db/.puppet_quicklook_installed_#{name}.yaml"
|
||||
unless File.exist?(dbfile)
|
||||
raise Puppet::Error.new("QuickLook DMG Package #{name} not installed.")
|
||||
end
|
||||
receipthash = YAML::load_file(dbfile)
|
||||
receipthash["files"].each do |appname|
|
||||
FileUtils.remove_entry_secure("#{$quicklookdmg_target}/#{appname}")
|
||||
unless $? == 0
|
||||
raise Puppet::Error.new("QuickLook DMG could not remove \"#{$quicklookdmg_target}/#{appname}\"")
|
||||
end
|
||||
end
|
||||
File.unlink(dbfile)
|
||||
qlmanage "-r"
|
||||
end
|
||||
|
||||
def self.installquicklookdmg(source, name)
|
||||
unless source =~ /\.dmg$/i
|
||||
raise Puppet::Error.new("Mac OS X QuickLook DMG's must specificy a source string ending in .dmg")
|
||||
end
|
||||
require 'open-uri'
|
||||
require 'facter/util/plist'
|
||||
cached_source = source
|
||||
if %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ cached_source
|
||||
cached_source = "/tmp/#{name}"
|
||||
begin
|
||||
curl "-o", cached_source, "-C", "-", "-k", "-s", "--url", source
|
||||
Puppet.debug "Success: curl transfered [#{name}]"
|
||||
rescue Puppet::ExecutionFailure
|
||||
Puppet.debug "curl did not transfer [#{name}]. Falling back to slower open-uri transfer methods."
|
||||
cached_source = source
|
||||
end
|
||||
end
|
||||
|
||||
begin
|
||||
open(cached_source) do |dmg|
|
||||
xml_str = hdiutil "mount", "-plist", "-nobrowse", "-readonly", "-mountrandom", "/tmp", dmg.path
|
||||
ptable = Plist::parse_xml xml_str
|
||||
# JJM Filter out all mount-paths into a single array, discard the rest.
|
||||
mounts = ptable['system-entities'].collect { |entity|
|
||||
entity['mount-point']
|
||||
}.select { |mountloc|; mountloc }
|
||||
begin
|
||||
mounts.each do |fspath|
|
||||
Dir.entries(fspath).select { |f|
|
||||
f =~ /\.qlgenerator$/i
|
||||
}.each do |app|
|
||||
installapp("#{fspath}/#{app}", name, source)
|
||||
end
|
||||
end # mounts.each do
|
||||
ensure
|
||||
hdiutil "eject", mounts[0]
|
||||
end # begin
|
||||
end # open() do
|
||||
ensure
|
||||
# JJM Remove the file if open-uri didn't already do so.
|
||||
File.unlink(cached_source) if File.exist?(cached_source)
|
||||
end # begin
|
||||
end # def self.installquicklookdmg
|
||||
|
||||
def query
|
||||
if FileTest.exists?("/var/db/.puppet_quicklook_installed_#{@resource[:name]}.yaml")
|
||||
return {:name => @resource[:name], :ensure => :present}
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
def install
|
||||
source = nil
|
||||
unless source = @resource[:source]
|
||||
raise Puppet::Error.new("Mac OS X quicklook DMG's must specify a package source.")
|
||||
end
|
||||
unless name = @resource[:name]
|
||||
raise Puppet::Error.new("Mac OS X quicklook DMG's must specify a package name.")
|
||||
end
|
||||
self.class.installquicklookdmg(source,name)
|
||||
end
|
||||
|
||||
def uninstall
|
||||
unless name = @resource[:name]
|
||||
raise Puppet::Error.new("Mac OS X QuickLook DMG's must specify a package name.")
|
||||
end
|
||||
self.class.uninstallquicklookdmg(name)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 82
|
||||
/dav/ikwadmin/!svn/ver/4425/linux/puppetmaster/etc_puppet/modules/puppet/manifests
|
||||
END
|
||||
init.pp
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 90
|
||||
/dav/ikwadmin/!svn/ver/4425/linux/puppetmaster/etc_puppet/modules/puppet/manifests/init.pp
|
||||
END
|
||||
@@ -1,65 +0,0 @@
|
||||
10
|
||||
|
||||
dir
|
||||
4547
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin/linux/puppetmaster/etc_puppet/modules/puppet/manifests
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin
|
||||
|
||||
|
||||
|
||||
2011-06-17T11:42:17.274278Z
|
||||
4425
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0e4a7186-e024-0410-a49b-aced43e0d94e
|
||||
|
||||
init.pp
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
d51edba0f5f29a336fd11da809c6400b
|
||||
2011-06-17T11:42:17.274278Z
|
||||
4425
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
5559
|
||||
|
||||
defines
|
||||
dir
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,208 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
class puppet ($ensure="present",
|
||||
$norunifloggedin=false,
|
||||
$daemonize=true,
|
||||
$run_hour="*/1",
|
||||
$run_minute="10"
|
||||
){
|
||||
|
||||
$puppet_service = $kernel ? {
|
||||
"Darwin" => "org.macports.puppet",
|
||||
"FreeBSD" => "puppetd",
|
||||
default => "puppet"
|
||||
}
|
||||
$factpath="/var/lib/puppet/lib/facter"
|
||||
case $kernel {
|
||||
"Linux": {
|
||||
$puppetpkgs = ["puppet","puppet-common"]
|
||||
Package { provider => "apt" }
|
||||
#Package["puppet-common"]{ before => Package["puppet"] }
|
||||
}
|
||||
default: {
|
||||
$puppetpkgs = "puppet"
|
||||
}
|
||||
}
|
||||
$puppet_linuxversion_real = $PUPPET_VERSION_LINUX ? {
|
||||
"" => "latest",
|
||||
default => $PUPPET_VERSION_LINUX,
|
||||
}
|
||||
# case $kernel {
|
||||
# "Linux": {
|
||||
# exec{"apt-get install -y puppet=$PUPPET_VERSION_LINUX puppet-common=${PUPPET_VERSION_LINUX}":
|
||||
# onlyif => "apt-show-versions -a puppet |tail -1 |grep -q upgradeable",
|
||||
# }
|
||||
# }
|
||||
# default: {
|
||||
package{$puppetpkgs:
|
||||
ensure => $ensure ? {
|
||||
"present" => $kernel ? {
|
||||
"Linux" => $puppet_linuxversion_real,
|
||||
default => $ensure,
|
||||
}
|
||||
},
|
||||
notify => Service["${puppet_service}"],
|
||||
}
|
||||
# }
|
||||
# }
|
||||
|
||||
package{["facter"]: ensure => "${ensure}", }
|
||||
|
||||
|
||||
service { "${puppet_service}":
|
||||
hasstatus => true,
|
||||
enable => "${daemonize}",
|
||||
ensure => "${daemonize}",
|
||||
}
|
||||
|
||||
$cron_real = $daemonize ? {
|
||||
false => "present",
|
||||
true => "absent",
|
||||
default => $ensure,
|
||||
}
|
||||
|
||||
notice("${fqdn} PUPPET-CRON: cron_real: ${cron_real}, daemonize: ${daemonize}, running: ${service_running}")
|
||||
cron { puppetrun:
|
||||
command => "/usr/local/sbin/puppetd_run.sh",
|
||||
user => root,
|
||||
minute => $run_minute,
|
||||
hour => $run_hour,
|
||||
ensure => "${cron_real}",
|
||||
}
|
||||
$maxsleep = 6400
|
||||
file{"/usr/local/sbin/puppetd_run.sh":
|
||||
content => template("puppet/puppetd_run.sh.erb"),
|
||||
mode => 0700,
|
||||
alias => "puppetd_run.sh",
|
||||
ensure => "${ensure}",
|
||||
}
|
||||
case $kernel {
|
||||
"Darwin": {
|
||||
file{"/Library/LaunchDaemons/org.macports.puppet.plist":
|
||||
source => "puppet:///modules/puppet/org.macports.puppet.plist",
|
||||
before => Service["${puppet_service}"],
|
||||
}
|
||||
file{"/opt/local/lib/ruby/site_ruby/1.8/puppet/provider/package/appdmg.rb":
|
||||
ensure => "absent",
|
||||
}
|
||||
}
|
||||
"Linux": {
|
||||
replace {"enable_puppet":
|
||||
file => "/etc/default/puppet",
|
||||
pattern => "START=no",
|
||||
replacement => "START=yes",
|
||||
before => Service["${puppet_service}"],
|
||||
}
|
||||
monit::process{"puppet":
|
||||
start => "/etc/init.d/puppet start",
|
||||
stop => "/etc/init.d/puppet stop",
|
||||
pidfile => "/var/run/puppet/agent.pid",
|
||||
additional => "if totalmem > 400 Mb for 10 cycles then RESTART",
|
||||
ensure => $daemonize ? {
|
||||
"true" => "present",
|
||||
default => "absent",
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$puppet_user = $operatingsystem ? {
|
||||
"Darwin" => $adm,
|
||||
default => "puppet",
|
||||
}
|
||||
$puppet_group = $operatingsystem ? {
|
||||
"Darwin" => "wheel",
|
||||
default => "puppet",
|
||||
}
|
||||
#"FreeBSD" => "/usr/local/etc/puppet/puppet.conf",
|
||||
$puppetconf = $operatingsystem ? {
|
||||
default => "/etc/puppet/puppet.conf",
|
||||
}
|
||||
|
||||
file{$puppetconf:
|
||||
content => template("puppet/puppet.conf.erb"),
|
||||
mode => 0644,
|
||||
owner => $puppet_user,
|
||||
ensure => "${ensure}",
|
||||
# require => [ Package["puppet"] ],
|
||||
}
|
||||
|
||||
#add facter variable to custom facts.
|
||||
file{"/etc/profile.d/puppet.sh":
|
||||
content => "export FACTERLIB=\"${factpath}\"\n",
|
||||
ensure => $ensure,
|
||||
}
|
||||
}
|
||||
|
||||
@@puppet::puppetmaster::privatedir{ $fqdn :
|
||||
l_fqdn => generate('/usr/bin/env', 'perl', '-e', '$_=shift;tr/[A-Z]/[a-z]/;print $_',"$fqdn")
|
||||
}
|
||||
|
||||
class puppet::puppet-dashboard ($ensure="present") {
|
||||
|
||||
package{["libjson-ruby","puppet-dashboard"]:
|
||||
ensure => $ensure,
|
||||
require => Apt::Repository["puppet-dashboard"],
|
||||
}
|
||||
apt::repository{"puppet-dashboard":
|
||||
key => "8347A27F",
|
||||
repository => "deb http://apt.puppetlabs.com/ubuntu lucid main\ndeb-src http://apt.puppetlabs.com/ubuntu lucid main\n",
|
||||
ensure => $ensure,
|
||||
}
|
||||
cron {"purge-reports":
|
||||
command => "cd /usr/share/puppet-dashboard && rake RAILS_ENV=production reports:prune upto=14 unit=day",
|
||||
user => "www-data",
|
||||
hour => "23",
|
||||
minute => "2",
|
||||
monthday => "*/14",
|
||||
ensure => $ensure,
|
||||
}
|
||||
|
||||
cron {"purge-optimizedb":
|
||||
command => "cd /usr/share/puppet-dashboard && rake RAILS_ENV=production db:raw:optimize",
|
||||
user => "www-data",
|
||||
hour => "23",
|
||||
minute => "20",
|
||||
monthday => "*/10",
|
||||
ensure => $ensure,
|
||||
}
|
||||
}
|
||||
|
||||
class puppet::puppetmaster ($ensure="present") {
|
||||
class{"activemq": ensure => $ensure }
|
||||
|
||||
package{"libnet-arp-perl": ensure => $ensure }
|
||||
Ganglia::Gmetric::Cron {
|
||||
source => "puppet/ganglia",
|
||||
ensure => "${ensure}",
|
||||
}
|
||||
ganglia::gmetric::cron{"puppetmaster.rb":
|
||||
runwhen => "5",
|
||||
}
|
||||
ganglia::gmetric::cron{"puppetmaster_compiletime.rb":
|
||||
runwhen => "60",
|
||||
}
|
||||
|
||||
service{"stompserver":
|
||||
ensure => false,
|
||||
enable => false,
|
||||
before => Class["activemq"],
|
||||
}
|
||||
service{"puppetqd":
|
||||
ensure => running,
|
||||
pattern => "puppet queue queue",
|
||||
enable => true,
|
||||
}
|
||||
### remove disk reports from time to time
|
||||
tidy{"${puppet_vardir}/reports":
|
||||
age => "1d",
|
||||
recurse => true,
|
||||
backup => false,
|
||||
}
|
||||
|
||||
# create [private] directories
|
||||
file { $puppet_privdir: ensure => directory }
|
||||
Puppet::Puppetmaster::Privatedir <<| |>>
|
||||
}
|
||||
|
||||
import "defines/*.pp"
|
||||
@@ -1,17 +0,0 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 90
|
||||
/dav/ikwadmin/!svn/ver/3493/linux/puppetmaster/etc_puppet/modules/puppet/manifests/defines
|
||||
END
|
||||
env_fact.pp
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 102
|
||||
/dav/ikwadmin/!svn/ver/2479/linux/puppetmaster/etc_puppet/modules/puppet/manifests/defines/env_fact.pp
|
||||
END
|
||||
private_dirs.pp
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 106
|
||||
/dav/ikwadmin/!svn/ver/3493/linux/puppetmaster/etc_puppet/modules/puppet/manifests/defines/private_dirs.pp
|
||||
END
|
||||
@@ -1,96 +0,0 @@
|
||||
10
|
||||
|
||||
dir
|
||||
4547
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin/linux/puppetmaster/etc_puppet/modules/puppet/manifests/defines
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin
|
||||
|
||||
|
||||
|
||||
2010-06-22T13:03:34.092649Z
|
||||
3493
|
||||
tkundoch
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0e4a7186-e024-0410-a49b-aced43e0d94e
|
||||
|
||||
env_fact.pp
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
e4084d688182441c58989585a7e1be7d
|
||||
2009-05-16T12:02:33.150252Z
|
||||
2479
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
745
|
||||
|
||||
private_dirs.pp
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
efa07844976a4dd05c4c2b1638ff557f
|
||||
2010-06-22T13:03:34.092649Z
|
||||
3493
|
||||
tkundoch
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
737
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,5 +0,0 @@
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,27 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
define puppet::env_fact(
|
||||
$factname="",
|
||||
$value,
|
||||
$ensure="present"
|
||||
){
|
||||
$factname_real = $factname ? {
|
||||
"" => upcase($name),
|
||||
default => upcase($factname)
|
||||
}
|
||||
if defined(Exec["create-env_fact.sh"]){
|
||||
debug("already defined.")
|
||||
}else{
|
||||
exec{"create-env_fact.sh":
|
||||
command => "echo \"#/bin/sh\n\" >>/etc/profile.d/env_facts.sh && chmod a+xr /etc/profile.d/env_facts.sh",
|
||||
onlyif => "test ! -e /etc/profile.d/env_facts.sh",
|
||||
before => Line["env_fact-${factname_real}"],
|
||||
}
|
||||
}
|
||||
|
||||
line{"env_fact-${factname_real}":
|
||||
line => "export FACTER_${factname_real}=${value}",
|
||||
file => "/etc/profile.d/env_facts.sh",
|
||||
ensure => $ensure,
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
##########################################################################
|
||||
## define puppet::puppetmaster::privatedir
|
||||
## $l_fqdn : hostname - lower case letters only
|
||||
## $title : hostname - as given in hosts client-cert
|
||||
##
|
||||
## $puppet_privdir (declared in site.pp) must already exist!
|
||||
|
||||
define puppet::puppetmaster::privatedir ( $l_fqdn ) {
|
||||
file { "${puppet_privdir}/${l_fqdn}":
|
||||
ensure => directory,
|
||||
owner => puppet
|
||||
} # file
|
||||
## create link if cert-hostname and DNS-provided fqdn differ
|
||||
if $title != $l_fqdn {
|
||||
file { "${puppet_privdir}/${title}":
|
||||
ensure => "${puppet_privdir}/${l_fqdn}",
|
||||
require => File["${puppet_privdir}/${l_fqdn}"]
|
||||
} # file
|
||||
} # if
|
||||
|
||||
} # define puppet::puppetmaster::privatedir
|
||||
@@ -1,17 +0,0 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 82
|
||||
/dav/ikwadmin/!svn/ver/4356/linux/puppetmaster/etc_puppet/modules/puppet/templates
|
||||
END
|
||||
puppetd_run.sh.erb
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 101
|
||||
/dav/ikwadmin/!svn/ver/4177/linux/puppetmaster/etc_puppet/modules/puppet/templates/puppetd_run.sh.erb
|
||||
END
|
||||
puppet.conf.erb
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 98
|
||||
/dav/ikwadmin/!svn/ver/4356/linux/puppetmaster/etc_puppet/modules/puppet/templates/puppet.conf.erb
|
||||
END
|
||||
@@ -1,96 +0,0 @@
|
||||
10
|
||||
|
||||
dir
|
||||
4547
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin/linux/puppetmaster/etc_puppet/modules/puppet/templates
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin
|
||||
|
||||
|
||||
|
||||
2011-05-28T15:15:01.096298Z
|
||||
4356
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0e4a7186-e024-0410-a49b-aced43e0d94e
|
||||
|
||||
puppetd_run.sh.erb
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
ce618a9916b301525921a51a97088ad7
|
||||
2011-04-05T08:02:08.474477Z
|
||||
4177
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1985
|
||||
|
||||
puppet.conf.erb
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
b8991541f2f7bded0451572a624d4d22
|
||||
2011-05-28T15:15:01.096298Z
|
||||
4356
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1581
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,9 +0,0 @@
|
||||
K 14
|
||||
svn:executable
|
||||
V 1
|
||||
*
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,55 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
[main]
|
||||
confdir=/etc/puppet
|
||||
logdir=/var/log/puppet
|
||||
vardir=/var/lib/puppet
|
||||
ssldir=$vardir/ssl
|
||||
#yamldir = $vardir/yaml
|
||||
rundir=/var/run/puppet
|
||||
factsignore = .svn CVS .git
|
||||
pluginsync=true
|
||||
factpath=$vardir/lib/facter
|
||||
templatedir=/etc/puppet/templates
|
||||
## should we use this?
|
||||
#prerun_command=/etc/puppet/etckeeper-commit-pre
|
||||
#postrun_command=/etc/puppet/etckeeper-commit-post
|
||||
|
||||
|
||||
<% if (fqdn == scope.lookupvar("puppetmaster_server")) || (fqdn == scope.lookupvar("puppetmasterdev_server")) -%>
|
||||
queue_type = stomp
|
||||
queue_source = stomp://localhost:61613
|
||||
dbadapter=mysql
|
||||
dbmigrate=true
|
||||
dbname=admin_<%= hostname %>
|
||||
dbserver=dbserv.ikw.uni-osnabrueck.de
|
||||
dbuser=puppetmaster
|
||||
dbpassword=Vb6mZztp6uLMQHfa
|
||||
|
||||
[master]
|
||||
ssl_client_header = SSL_CLIENT_S_DN
|
||||
ssl_client_verify_header = SSL_CLIENT_VERIFY
|
||||
#catalog_format=marshal
|
||||
#reports=store,http
|
||||
# store only to dashboard
|
||||
reports=http
|
||||
#reporturl=http://localhost/reports/upload
|
||||
reporturl="http://ikw.uni-osnabrueck.de/puppet-dashboard/reports/upload"
|
||||
# this is broken. why? <% scope.lookupvar("puppetdashboard_reporturl") -%>
|
||||
#graph=true
|
||||
#rrdgraph=false
|
||||
modulepath=/etc/puppet/modules:/etc/puppet/modules-public:/etc/puppet/modules-common:/etc/puppet/modules-external
|
||||
async_storeconfigs=true
|
||||
#storeconfigs=true
|
||||
rails_loglevel=info
|
||||
dbconnections=20
|
||||
<% end -%>
|
||||
|
||||
[agent]
|
||||
# Make sure all log messages are sent to the right directory
|
||||
# This directory must be writable by the puppet user
|
||||
runinterval=1800
|
||||
splay=true
|
||||
report=true
|
||||
server=<%= scope.lookupvar("puppetmaster_server") %>
|
||||
configtimeout=920
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# $Id$
|
||||
|
||||
# a wrapper script, to run puppetd after a random time
|
||||
# this will be called by cron at the same time on each client,
|
||||
# but should not call the master at the same time as the others.
|
||||
|
||||
<% if norunifloggedin == true -%>
|
||||
# not running if users are logged in
|
||||
[[ $(who|wc -l) -gt 0 ]] && exit 0
|
||||
<% end -%>
|
||||
|
||||
export FACTERLIB="<%= scope.lookupvar("factpath") %>"
|
||||
PATH="/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
PUPPET=$(which puppetd)
|
||||
[[ -e ${PUPPET} ]] || exit 1
|
||||
ISUNIIP=$(ifconfig |grep -c -e "131\.173\.3[2345]")
|
||||
PIDF="/tmp/puppetd_run.pid"
|
||||
|
||||
function cleanup {
|
||||
[[ -e ${PIDF} ]] && rm -f ${PIDF}
|
||||
exit 0
|
||||
}
|
||||
|
||||
if [ -e ${PIDF} ]; then
|
||||
PID=`cat ${PIDF}`
|
||||
if [ $(ps -eo pid |grep -c ${PID}) -gt 1 ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
# write our pid
|
||||
echo -n $$ >${PIDF}
|
||||
|
||||
if [ ${ISUNIIP} -gt 0 ]; then
|
||||
if [ -e ${PUPPET} ]; then
|
||||
#mac os X laptop check
|
||||
if [ -e /usr/bin/pmset ]; then
|
||||
if [ $(/usr/bin/pmset -g batt | grep -c "Battery Power") -eq 1 ]; then
|
||||
#we are running on battery and do not want to do anything
|
||||
cleanup
|
||||
fi
|
||||
fi
|
||||
#Linux laptop check
|
||||
if [ -e /proc/acpi/ac_adapter/AC/state ]; then
|
||||
if [ $(grep -c "on-line" /proc/acpi/ac_adapter/AC/state) -eq 0 ]; then
|
||||
#we are running on battery and do not want to do anything
|
||||
cleanup
|
||||
fi
|
||||
fi
|
||||
|
||||
MAXSLEEP=<%= maxsleep %> #How many seconds to wait maximally
|
||||
SLEEP=${RANDOM}
|
||||
I=${RANDOM}
|
||||
|
||||
# $RANDOM must be called several times, to ensure it really
|
||||
# is something like random
|
||||
for x in 1 2 3 4 5 6 7 8 9 10 11 12; do
|
||||
SLEEP=${RANDOM}
|
||||
done
|
||||
# wait maximally $MAXSLEEP seconds
|
||||
sleep $(expr ${SLEEP} % ${MAXSLEEP})
|
||||
# run puppetd
|
||||
nice -n 12 $PUPPET -t 2&>/var/log/puppet/puppetd_run.log
|
||||
fi
|
||||
fi
|
||||
# cleanup the pidfile
|
||||
cleanup
|
||||
Reference in New Issue
Block a user