<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tim's Weblog</title>
	<atom:link href="http://blog.hokkertjes.nl/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hokkertjes.nl</link>
	<description>Random Thoughts and Rants</description>
	<lastBuildDate>Wed, 01 Sep 2010 11:05:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Puppet Tips&amp;Tricks: Variable variables</title>
		<link>http://blog.kumina.nl/2010/09/puppet-tipstricks-variable-variables/</link>
		<comments>http://blog.kumina.nl/2010/09/puppet-tipstricks-variable-variables/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 11:05:48 +0000</pubDate>
		<dc:creator>Tim Stoop</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[inline_template]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[puppet-tips-and-tricks]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[facter]]></category>
		<category><![CDATA[variable]]></category>
		<category><![CDATA[variables]]></category>

		<guid isPermaLink="false">http://blog.kumina.nl/?p=134</guid>
		<description><![CDATA[Sometimes you want to use variable variables, for instance when you want to iterate over all the ipaddress_* facts that facter found. Using something like ${ipaddress_$if} doesn&#8217;t work, though. Inline_template to the rescue! Volcane on IRC suggested the following solution, which works great: $ifs = split($interfaces,",") define do_this { $mule = "ipaddress_${name}" $donkey = inline_template("&#060;%= [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you want to use variable variables, for instance when you want to iterate over all the ipaddress_* facts that facter found. Using something like <code>${ipaddress_$if}</code> doesn&#8217;t work, though. Inline_template to the rescue! Volcane on IRC suggested the following solution, which works great:</p>
<pre>$ifs = split($interfaces,",")

define do_this {
	$mule = "ipaddress_${name}"
	$donkey = inline_template("&lt;%= scope.lookupvar(mule) %&gt;")

	notify { "Found interface $donkey":; }
}

do_this { $ifs:; }</pre>
<p>This will output:</p>
<pre>$ sudo puppet net.pp
notice: Found interface 172.29.121.22
notice: //Do_this[eth0]/Notify[Found interface 172.29.121.22]/message: defined 'message' as 'Found interface 172.29.121.22'
notice: Found interface 213.207.83.56
notice: //Do_this[eth1]/Notify[Found interface 213.207.83.56]/message: defined 'message' as 'Found interface 213.207.83.56'</pre>
<p>Hope this helps someone else! Leave a message if it does.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kumina.nl/2010/09/puppet-tipstricks-variable-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter Weekly Updates for 2010-08-29</title>
		<link>http://blog.hokkertjes.nl/2010/08/29/twitter-weekly-updates-for-2010-08-29/</link>
		<comments>http://blog.hokkertjes.nl/2010/08/29/twitter-weekly-updates-for-2010-08-29/#comments</comments>
		<pubDate>Sun, 29 Aug 2010 00:31:00 +0000</pubDate>
		<dc:creator>site admin</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.hokkertjes.nl/2010/08/29/twitter-weekly-updates-for-2010-08-29/</guid>
		<description><![CDATA[Worked until 3am last night. Hope I don&#039;t need that much time today&#8230; # Got a postcard from Mongolia! How awesome is that?? #farfaraway # #Varnish is awesome. # @ariejan We use it to locally cache pictures stored on S3 for http://www.nationalebeeldbank.nl… works like a charm! in reply to ariejan # Moeite gedaan om op [...]]]></description>
			<content:encoded><![CDATA[<ul class="aktt_tweet_digest">
<li>Worked until 3am last night. Hope I don&#039;t need that much time today&#8230; <a href="http://twitter.com/timstoop/statuses/22071703640" class="aktt_tweet_time">#</a></li>
<li>Got a postcard from Mongolia! How awesome is that?? #<a href="http://search.twitter.com/search?q=%23farfaraway" class="aktt_hashtag">farfaraway</a> <a href="http://twitter.com/timstoop/statuses/22072358180" class="aktt_tweet_time">#</a></li>
<li>#<a href="http://search.twitter.com/search?q=%23Varnish" class="aktt_hashtag">Varnish</a> is awesome. <a href="http://twitter.com/timstoop/statuses/22095854849" class="aktt_tweet_time">#</a></li>
<li>@<a href="http://twitter.com/ariejan" class="aktt_username">ariejan</a> We use it to locally cache pictures stored on S3 for <a href="http://www.nationalebeeldbank.nl…" rel="nofollow">http://www.nationalebeeldbank.nl…</a> works like a charm! <a href="http://twitter.com/ariejan/statuses/22096052030" class="aktt_tweet_reply">in reply to ariejan</a> <a href="http://twitter.com/timstoop/statuses/22096687354" class="aktt_tweet_time">#</a></li>
<li>Moeite gedaan om op tijd op kantoor te zijn zodat collega niet alleen zit, mist hij zijn trein&#8230; *zucht* <a href="http://twitter.com/timstoop/statuses/22155670690" class="aktt_tweet_time">#</a></li>
<li>I miss the sysadmins in here <img src='http://blog.hokkertjes.nl/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  <a href="http://i.imgur.com/G7WyP.gif" rel="shadowbox[post-954];player=img;">http://i.imgur.com/G7WyP.gif</a> <a href="http://twitter.com/timstoop/statuses/22165662599" class="aktt_tweet_time">#</a></li>
<li>@<a href="http://twitter.com/APechtold" class="aktt_username">APechtold</a> Bel ik liever @<a href="http://twitter.com/FemkeHalsema" class="aktt_username">FemkeHalsema</a> if you don&#039;t mind&#8230; #<a href="http://search.twitter.com/search?q=%23giro555" class="aktt_hashtag">giro555</a> <a href="http://twitter.com/APechtold/statuses/22164441807" class="aktt_tweet_reply">in reply to APechtold</a> <a href="http://twitter.com/timstoop/statuses/22165709528" class="aktt_tweet_time">#</a></li>
<li>Small little unix utils are awesome, but xmlstarlet should recognise for itself if a default namespace is set&#8230; Took me 45 minutes&#8230; <a href="http://twitter.com/timstoop/statuses/22267322647" class="aktt_tweet_time">#</a></li>
</ul>
<p class="aktt_credit">Powered by <a href="http://alexking.org/projects/wordpress">Twitter Tools</a></p>

<!-- start wp-tags-to-technorati 1.02 -->

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.hokkertjes.nl/2010/08/29/twitter-weekly-updates-for-2010-08-29/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GlassFish 3.0.1 on Debian Lenny, Puppet style</title>
		<link>http://blog.kumina.nl/2010/08/glassfish-3-0-1-on-debian-lenny-puppet-style/</link>
		<comments>http://blog.kumina.nl/2010/08/glassfish-3-0-1-on-debian-lenny-puppet-style/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 08:38:49 +0000</pubDate>
		<dc:creator>Tim Stoop</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[module]]></category>

		<guid isPermaLink="false">http://blog.kumina.nl/?p=131</guid>
		<description><![CDATA[We've created a puppet package that completely installs and patches GlassFish 3.0.1 on Debian Lenny. Check it out!]]></description>
			<content:encoded><![CDATA[<p>Recently, I found a way to make the <a href="https://glassfish.dev.java.net/">GlassFish</a> supplied pkg(5) tool run using Debian&#8217;s python interpreter and associated libs. I also spent a while trying to package it in a sane way, but I&#8217;m afraid I lack the knowledge of Java and Debian package internals to do this properly (I&#8217;ve <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=591348">requested</a> the package, though). But in the meantime we still need a nice way to setup GlassFish on a Debian Lenny machine. So I&#8217;ve turned to <a href="http://www.puppetlabs.com/puppet/introduction/">puppet</a>, as usual.</p>
<p>You can find the module here: <a href="http://blog.kumina.nl/wp-content/uploads/2010/08/glassfish.tar.bz2">glassfish.tar.bz2</a> (12.8kB)</p>
<p>It doesn&#8217;t contain everything, though. You still need to download the glassfish ZIP file from <a href="http://download.java.net/glassfish/3.0.1/release/glassfish-3.0.1.zip">here</a> and rename that file to <code>glassfish.zip</code> and add it in the files directory of the module. After that, you can just <code>include glassfish</code> and it gets set-up!<br />
<span id="more-131"></span><br />
The module does several things, including installing a very small facter Fact. The fact just checks if several important files/directories exist and if so, it deems GlassFish &#8216;installed&#8217;. If not, the module includes the <code>glassfish::initial_setup</code> class, which does the initial setup of GlassFish. You don&#8217;t want to include this class on every run, because it adds some crud in your /tmp, including some touchstone files. The glassfish_installed was created for determining this (following an example given to me by <a href="http://www.devco.net/">Volcane on IRC</a>, thanks man!). The check probably isn&#8217;t perfect, but it&#8217;s good enough for our purposes.</p>
<p>This module adds the Debian non-free repository to your APT&#8217;s sources.list and installs the sun-java6-jdk package. In the process it also agrees with the <a href="http://download.java.net/dlj/DLJ-FAQ.html">Sun DLJ License</a>. If you prefer the openjdk package, those should work too. You&#8217;ll just have to remove the stuff needed for installing sun-java6-jdk from the module.</p>
<p>Because we&#8217;re not fond of the way the GlassFish developers packaged the pkg(5) tool in there, the installer applies the recipe <a href="http://blog.kumina.nl/2010/07/glassfish-3-0-1s-pkg-tool-using-debians-python-packages/">described earlier on this blog</a>. You can see these steps in the <code>glassfish::initial_setup</code> subclass. There are a lot of exec&#8217;s in there which do most of the important work.</p>
<p>Due to security concerns, the module creates a glassfish user and group and makes sure all the code is readable by that user and group. It also makes sure the code is writable by the group, so you can easily add the local accounts from developers to the group and give them access to the code. If you want to allow them to do administrative tasks on GlassFish, you can add these rules to your <code>/etc/sudoers</code>:</p>
<pre>%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/bin/asadmin
%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/bin/pkg
%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/glassfish/bin/appclient
%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/glassfish/bin/asadmin
%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/glassfish/bin/asupgrade
%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/glassfish/bin/capture-schema
%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/glassfish/bin/jspc
%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/glassfish/bin/package-appclient
%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/glassfish/bin/schemagen
%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/glassfish/bin/startserv
%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/glassfish/bin/stopserv
%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/glassfish/bin/wscompile
%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/glassfish/bin/wsdeploy
%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/glassfish/bin/wsgen
%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/glassfish/bin/wsimport
%glassfish	ALL=(glassfish) NOPASSWD: /opt/glassfishv3/glassfish/bin/xjc</pre>
<p>For easy reinstall, we symlink the <code>/opt/glassfishv3/glassfish/domains</code> directory to <code>/srv/glassfish/domains</code>. This allows you to completely remove <code>/opt/glassfishv3</code> to perform a reinstall with the puppet module (because the removal of that directory triggers the inclusion of <code>glassfish::initial_setup</code> without breaking developer code.</p>
<p>The second time you run the script, all the crud is removed, including some .bat files that are part of the distribution of GlassFish. We leave JavaDB and mq in place, even though we don&#8217;t use them at all. So you might want to create some customization for those yourself.</p>
<p>Because we prefer to compile a small .so file from source instead of installing the ia32 libs, several developer packages are installed. These are not automatically removed in <code>glassfish::cleanup</code>, because the module cannot know if these packages are needed by another module too. So you might want to manually do a <code>sudo apt-get --purge remove python-dev gcc libc6-dev unzip patch</code> if you&#8217;re sure you don&#8217;t need these packages anywhere else. (Note: If you install them anywhere else in your puppet modules too, you&#8217;ll probably get an error from puppet about duplicate definitions anyway&#8230;)</p>
<p>The <code>glassfish::initial_setup</code> class has a lot of ordering added, but we&#8217;ve taken care of only requiring those resources that are actually needed, so the install isn&#8217;t broken if one thing doesn&#8217;t work. You&#8217;ll have to take care of the stuff that doesn&#8217;t work yourself, though.</p>
<p>Finally, on a second puppet run after the installation, the <code>glassfish::cleanup</code> class is included, which removes the crud we needed for the initial setup.</p>
<p>Some areas still need a little work, for example the initscript. It currently relies on sudo, which is not the nicest solution. That will be fixed eventually and I&#8217;ll update the tarball here. For now, enjoy and I hope this helps someone!</p>
<p>Do let us know if you have improvements to this puppet recipe!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kumina.nl/2010/08/glassfish-3-0-1-on-debian-lenny-puppet-style/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fluffy died :(</title>
		<link>http://blog.hokkertjes.nl/2010/08/04/fluffy-died/</link>
		<comments>http://blog.hokkertjes.nl/2010/08/04/fluffy-died/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 11:05:47 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[bunny]]></category>
		<category><![CDATA[fluffy]]></category>
		<category><![CDATA[pets]]></category>

		<guid isPermaLink="false">http://blog.hokkertjes.nl/?p=951</guid>
		<description><![CDATA[I bought her from a pet shop about 5,5 years ago and we&#8217;ve been through a lot together since then. But yesterday evening, when I went out to take care of the bunnies, I noticed Fluffy was not moving anymore. She didn&#8217;t even come to greet me when I opened the cage. So I prodded [...]]]></description>
			<content:encoded><![CDATA[<p>I bought her from a pet shop <a href="http://blog.hokkertjes.nl/2005/03/25/my-bunny/">about 5,5 years ago</a> and we&#8217;ve been through a lot together since then. But yesterday evening, when I went out to take care of the bunnies, I noticed Fluffy was not moving anymore. She didn&#8217;t even come to greet me when I opened the cage. So I prodded her a little and found her stone cold. Apparantly, she died somewhere during the day <img src='http://blog.hokkertjes.nl/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>I&#8217;ll remember her as my little bunny-dog, since she could fetch and come sit on my lap when I called out to her. She was always there when I opened her little house, because she wanted some petting. I&#8217;ll miss her.</p>

<!-- start wp-tags-to-technorati 1.02 -->

<p class='technorati-tags'>Tags: <a class='technorati-link' href='http://technorati.com/tag/bunny' rel='tag' target='_self'>bunny</a>, <a class='technorati-link' href='http://technorati.com/tag/fluffy' rel='tag' target='_self'>fluffy</a>, <a class='technorati-link' href='http://technorati.com/tag/pets' rel='tag' target='_self'>pets</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.hokkertjes.nl/2010/08/04/fluffy-died/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GlassFish 3.0.1′s pkg tool using Debian’s Python packages</title>
		<link>http://blog.kumina.nl/2010/07/glassfish-3-0-1s-pkg-tool-using-debians-python-packages/</link>
		<comments>http://blog.kumina.nl/2010/07/glassfish-3-0-1s-pkg-tool-using-debians-python-packages/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 11:41:07 +0000</pubDate>
		<dc:creator>Tim Stoop</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[64bit]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[opensolaris]]></category>
		<category><![CDATA[pkg]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.kumina.nl/?p=95</guid>
		<description><![CDATA[Short howto on how to use Debian's Python interpreter with GlassFish's supplied pkg tool on a 64 bit system.]]></description>
			<content:encoded><![CDATA[<p>While setting up <a href="https://glassfish.dev.java.net/">GlassFish 3.0.1</a> for a customer on <a href="http://www.debian.org">Debian Lenny</a> using 64 bit machines, I ran into the problem that the update tool shipped with GlassFish (<a href="http://www.opensolaris.com/">OpenSolaris</a>&#8216;s <a href="http://hub.opensolaris.org/bin/view/Project+pkg/WebHome">pkg tool</a>) uses a <a href="http://www.python.org">Python</a> interpreter which is part of the package. That Python interpreter however is 32 bit, which requires the ia32 libraries to be installed. Worse, it requires lididn in 32 bit, which is not part of the default Debian packages, so I had to get that one from the (very nice) <a href="http://debian-multimedia.org/dists/stable/main/binary-amd64/package/ia32-libs-libidn11.php">Debian Multimedia repository</a>. Although that&#8217;s a quick fix to get stuff working, we rather not use these repositories on production machines, due to security concerns and the like. Also, upgrades are easier if you only use the standard Debian repositories.</p>
<p>So I decided to see if I could get it working with the Debian supplied Python interpreter. One problem is that there&#8217;s a shared object file written in C which is part of the pkg application. That file is a 32 bit ELF too. So we&#8217;re going to download that source and recompile it for 64 bit. If you&#8217;re on a 32 bit system, you can skip that step (although it doesn&#8217;t hurt to do it anyway). First, we need to install the following packages:<br />
<span id="more-95"></span><br />
<code>apt-get install python2.5 python2.5-dev gcc python-cherrypy python-mako python-openssl python-ply python-pycurl python-simplejson</code></p>
<p>Now download the source for the _actions.c file from <a href="http://src.opensolaris.org/source/xref/pkg/gate/src/modules/actions/_actions.c">here</a> (link to webpage, press download in the top).</p>
<p>Compile it with the following command:<br />
<code>gcc -I/usr/include/python2.5 -shared -fpic -O2 _actions.c -o _actions.so</code></p>
<p>Keep the resulting .so file, we&#8217;re going to replace it once we&#8217;ve downloaded GlassFish. Which is the next step, actually. So download GlassFish and set it up somewhere. I downloaded the tarball and unzipped it into /opt/glassfish.</p>
<p>The resulting directory contains several directories, including a pkg and a glassfish directory. The /opt/glassfish/glassfish directory is the actual GlassFish application. The pkg directory contains the pkg tool which is used to upgrade the GlassFish addons and systems and stuff (don&#8217;t ask me about the details, I&#8217;m not a Java developer, only a sysadmin). The first time you start it, it installs some stuff. So just run the following:<br />
<code>/opt/glassfish/bin/pkg</code></p>
<p>Next, mv the file /opt/glassfish/pkg/bin/pkg to /opt/glassfish/pkg/bin/pkg.orig. We do this since this script does all kinds of magic which we do not need. Also, it runs the pkg python code with the python2.4 interpreter that&#8217;s part of the package. We don&#8217;t want that. Let&#8217;s fix it.</p>
<p>Make a simple script to replace the one we moved away. I use the following, which works for me:</p>
<pre>#!/bin/sh
python /opt/glassfish/pkg/bin/client.py</pre>
<p>If you start it now, you&#8217;ll get an error:</p>
<pre>$ python /opt/glassfish/pkg/bin/client.py
Traceback (most recent call last):
  File "/opt/glassfish/pkg/bin/client.py", line 60, in <module>
    import pkg
ImportError: No module named pkg</pre>
<p>Ok, let&#8217;s fix that! Start with creating a directory called /opt/glassfish/pkg/custom-lib. You can change the name into anything you want, of course, as long as it&#8217;s clear that this is where you&#8217;re going to put the pkg python module. Actually, let&#8217;s do that immediatly: <code>cp -r /opt/glassfish/pkg/vendor-packages/pkg /opt/glassfish/pkg/custom-lib</code></p>
<p>Change our script which we setup to run pkg into the following:</p>
<pre>#!/bin/sh
PYTHONPATH="/opt/glassfish/pkg/custom-lib" python /opt/glassfish/pkg/bin/client.py</pre>
<p>You need to have only the pkg module in there, because the PYTHONPATH variable takes precedence over the other modules installed via the Debian packages. Run the script and you&#8217;ll get a new error:</p>
<pre>Traceback (most recent call last):
  File "/opt/glassfish/pkg/bin/client.py", line 61, in <module>
    import pkg.actions as actions
  File "/opt/glassfish/pkg/custom-lib/pkg/actions/__init__.py", line 144, in <module>
    from _actions import _fromstr
ImportError: /opt/glassfish/pkg/custom-lib/pkg/actions/_actions.so: wrong ELF class: ELFCLASS32</pre>
<p>If you don&#8217;t get this error, you&#8217;re on a 32 bit system and you&#8217;re done! Congratulations! Otherwise, we&#8217;re going to copy the _actions.so file we compiled earlier over the one that&#8217;s packaged with GlassFish 3.0.1. Just copy it over the other file, like so: <code>cp _actions.so /opt/glassfish/pkg/custom-lib/pkg/actions/_actions.so</code></p>
<p>Now we&#8217;re really done! You should be able to run <code>/opt/glassfish/bin/pkg image-update</code> now and update your currently installed GlassFish 3.0.1 with the latest modules and stuff. Awesome!</p>
<p>I&#8217;m in the process of creating a Debian package for GlassFish 3.0.1 which incorporated this fix. So if you&#8217;re not in a hurry or you&#8217;re reading this way after it was posted, you might want to check out <a href="http://debian.kumina.nl">debian.kumina.nl</a> to see if the package is available.</p>
<p>Hope this helps someone!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kumina.nl/2010/07/glassfish-3-0-1s-pkg-tool-using-debians-python-packages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress MU and /etc/hosts file</title>
		<link>http://blog.kumina.nl/2010/07/wordpress-mu-and-etchosts-file/</link>
		<comments>http://blog.kumina.nl/2010/07/wordpress-mu-and-etchosts-file/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 15:01:12 +0000</pubDate>
		<dc:creator>Tim Stoop</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[hosts]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[puppet-tips-and-tricks]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.kumina.nl/?p=89</guid>
		<description><![CDATA[Sometimes you need to hack up some code to work around some network problems. Sometimes you're not very proud of it, but you want to share your solution nonetheless. This is one of those ugly solutions...]]></description>
			<content:encoded><![CDATA[<p>Due to a silly networking problem originating from the <a href="http://www.linuxvirtualserver.org/">LVS</a> installation we&#8217;re using, we&#8217;re stuck with a setup in which machines in the DMZ cannot access themselves via their external addresses. This is a problem for several scripts which refer to their own URL when doing some maintenance. Especially with a certain <a href="http://mu.wordpress.org/">WordPress MU</a> installation managed by our friends from <a href="http://interconnectit.co.uk/">Interconnect IT</a>, we ran into trouble when they tried to update their WordPress code.</p>
<p>Puppet to the rescue. Although not something I&#8217;m especially proud of, I can imagine other using this as an example to fix other problems. What we do is use the wp-config.php from the WordPress installation to get data from the database that WordPress MU connects to. We use a PHP script to retrieve that data and format it in a comma-separated-value list. We then use this output to create a <a href="http://projects.puppetlabs.com/projects/facter">Facter</a> fact, which we use in puppet to create entries in the /etc/hosts file.<br />
<span id="more-89"></span><br />
You could eliminate the bash scripting by making sure the PHP script copies the files and outputs in the correct format, but it&#8217;s been ages since I&#8217;ve written anything remotely PHPish, so I decided to only do the bare minimum in PHP and do the rest in bash. YMMV.</p>
<p>Now without further a-do, here&#8217;s the shell script we run:</p>
<pre>#!/bin/sh

# We want to change to the directory where this script is installed.
OLDDIR=`pwd`
cd /opt/wp-domain

# Make sure we have an empty wp-settings.php, because wp-config.php includes
# it.
touch wp-settings.php

# Copy wp-config.php from the WordPress MU installation.
# CHANGEME You want to change this path, I'm sure...
cp /srv/www/wordpress-mu/wp-config.php .

# Get the output from the script.
# Some strange stuff to make sure we don't get an error
php output-list.php > /dev/null 2>&#038;1

# FIXME Too lazy to think of a way to do this in one step...
if [ $? -gt 0 ]; then
        cd $OLDDIR
        exit 1
else
        php output-list.php | rev | cut -c 2- | rev
        cd $OLDDIR
        exit 0
fi</pre>
<p>This is the (very simple) PHP script we use:</p>
<pre>&lt;?

require_once('wp-config.php');

$db = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$db) {
        echo "Could not connect: " . mysql_error();
        die(1);
}

mysql_select_db(DB_NAME, $db);

$query = "select domain from wp_blogs";

$result = mysql_query($query);

if (!$result) {
        echo "Query failed: " . mysql_error();
        die(1);
}

$ret = "";

while ($row = mysql_fetch_assoc($result)) {
        $ret = $ret . $row['domain'] . ";";
}

echo $ret;

?&gt;
</pre>
<p>This is the very small Fact I&#8217;ve written for it:</p>
<pre>unless not FileTest.file?("/opt/wp-domain/getdomains.sh")
	Facter.add("wordpressdomains") do
        	setcode do
        	        %x{/opt/wp-domain/getdomains.sh}.chomp
        	end
	end
end</pre>
<p>And last but not least, the puppet code:</p>
<pre>class kbp-wordpressmu {
	file {
		"/opt/wp-domain":
			ensure => directory;
		"/opt/wp-domain/getdomains.sh":
			source => "puppet://puppet/kbp-wordpressmu/getdomains.sh",
			mode   => "755";
		"/opt/wp-domain/output-list.php":
			source => "puppet://puppet/kbp-wordpressmu/output-list.php";
	}

	$domains = split($wordpressdomains,";")

	if $domains != [] and $domains != "" {
		host { $domains:
			ip => $ipaddress,
		}
	}
}</pre>
<p>Do let me know if you think this can be way cleaner!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kumina.nl/2010/07/wordpress-mu-and-etchosts-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Puppet Tips&amp;Tricks: checking if a value is present in an array</title>
		<link>http://blog.kumina.nl/2010/06/puppet-tipstricks-checking-if-a-value-is-present-in-an-array/</link>
		<comments>http://blog.kumina.nl/2010/06/puppet-tipstricks-checking-if-a-value-is-present-in-an-array/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 12:34:05 +0000</pubDate>
		<dc:creator>Tim Stoop</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[inline_template]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[puppet-tips-and-tricks]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://blog.kumina.nl/?p=85</guid>
		<description><![CDATA[Although it's going to be easier in puppet 2.6, this helps you if you want to check if a certain value is present in a puppet array and perform actions based on that.]]></description>
			<content:encoded><![CDATA[<p>I tend to create fairly ubiquitous defines, which allow for a lot of functionality. For that, it would be nice if you could tell puppet &#8220;if value X is present in array Y, do this&#8221;. I made it a feature request for puppet (<a href="http://projects.puppetlabs.com/issues/3871">#3871</a>), which was luckily accepted and will be implemented in the next version of puppet. However, for the time being I needed this fixed. So I spend some time creating an ugly solution for this in older versions of puppet. Hope it helps someone!</p>
<pre># Setup additional services for this vhost, if any are required.
# Start with a general check to prevent a lot of work when it's
# not needed.
if $allow != "" {
           # FIXME Ideally we want something that simply does
           #  for i in allow do include $http::allow_$i
           # but that doesn't work (yet?).
           # W00t! That's going to be added in 2.6! #3871
           if inline_template("<%= allow.include?('php5') %>") == "true" {
                     include allow_php5
           }
           if inline_template("<%= allow.include?('rewrite') %>") == "true" {
                     include allow_rewrite
           }
           if inline_template("<%= allow.include?('ruby') %>") == "true" {
                     include allow_ruby
           }
           if inline_template("<%= allow.include?('python') %>") == "true" {
                     include allow_python
           }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.kumina.nl/2010/06/puppet-tipstricks-checking-if-a-value-is-present-in-an-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tips&amp;Tricks: Get long running queries from PostgreSQL</title>
		<link>http://blog.kumina.nl/2010/06/tipstricks-get-long-running-queries-from-postgresql/</link>
		<comments>http://blog.kumina.nl/2010/06/tipstricks-get-long-running-queries-from-postgresql/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 12:24:29 +0000</pubDate>
		<dc:creator>Tim Stoop</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://blog.kumina.nl/?p=81</guid>
		<description><![CDATA[A relatively simple one-liner for getting long running queries out of PostgreSQL.]]></description>
			<content:encoded><![CDATA[<p>Was looking for a method of getting queries that are running longer than 5 minutes out of a PostgreSQL. This solution needs stats_command_string enabled in the postgresql.conf, though. The query you can run:</p>
<p><code> echo "select procpid,datname,current_query,now() - pg_stat_activity.query_start as duration from pg_stat_activity where pg_stat_activity.current_query <> '<IDLE>'::text and now() - pg_stat_activity.query_start > interval '5 minutes'" | sudo -u postgres psql</code></p>
<p>Hope this helps someone!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kumina.nl/2010/06/tipstricks-get-long-running-queries-from-postgresql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic lawnmower</title>
		<link>http://blog.hokkertjes.nl/2010/04/25/automatic-lawnmower/</link>
		<comments>http://blog.hokkertjes.nl/2010/04/25/automatic-lawnmower/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 13:11:21 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[automatic]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[lawnmower]]></category>

		<guid isPermaLink="false">http://blog.hokkertjes.nl/?p=932</guid>
		<description><![CDATA[Ah man, I want one! (via There I Fixed It) Tags: automatic, fix, funny, lawnmower]]></description>
			<content:encoded><![CDATA[<p>Ah man, I want one!<br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="437" height="333" id="viddler"><param name="movie" value="http://www.viddler.com/player/8e41449e/" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="flashvars" value="fake=1"/><embed src="http://www.viddler.com/player/8e41449e/" width="437" height="333" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" flashvars="fake=1" name="viddler" ></embed></object><br />
(via <a href="http://thereifixedit.com/">There I Fixed It</a>)</p>

<!-- start wp-tags-to-technorati 1.02 -->

<p class='technorati-tags'>Tags: <a class='technorati-link' href='http://technorati.com/tag/automatic' rel='tag' target='_self'>automatic</a>, <a class='technorati-link' href='http://technorati.com/tag/fix' rel='tag' target='_self'>fix</a>, <a class='technorati-link' href='http://technorati.com/tag/funny' rel='tag' target='_self'>funny</a>, <a class='technorati-link' href='http://technorati.com/tag/lawnmower' rel='tag' target='_self'>lawnmower</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.hokkertjes.nl/2010/04/25/automatic-lawnmower/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hyves kan&#8230;</title>
		<link>http://blog.hokkertjes.nl/2010/04/09/hyves-kan/</link>
		<comments>http://blog.hokkertjes.nl/2010/04/09/hyves-kan/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 20:31:56 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[dutch]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[funny]]></category>

		<guid isPermaLink="false">http://blog.hokkertjes.nl/?p=928</guid>
		<description><![CDATA[Hoe raadt ie het zo!?!?! Tags: dutch, error, funny]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.hokkertjes.nl/wp-content/uploads/2010/04/Schermafbeelding-2010-04-09-om-22.30.37.png" rel="shadowbox[post-928];player=img;"><img src="http://blog.hokkertjes.nl/wp-content/uploads/2010/04/Schermafbeelding-2010-04-09-om-22.30.37-300x50.png" alt="" title="Schermafbeelding 2010-04-09 om 22.30.37" width="300" height="50" class="alignnone size-medium wp-image-929" /></a></p>
<p>Hoe raadt ie het zo!?!?!</p>

<!-- start wp-tags-to-technorati 1.02 -->

<p class='technorati-tags'>Tags: <a class='technorati-link' href='http://technorati.com/tag/dutch' rel='tag' target='_self'>dutch</a>, <a class='technorati-link' href='http://technorati.com/tag/error' rel='tag' target='_self'>error</a>, <a class='technorati-link' href='http://technorati.com/tag/funny' rel='tag' target='_self'>funny</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.hokkertjes.nl/2010/04/09/hyves-kan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
