<?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>Sexy Sexy Penguins &#187; puppet</title>
	<atom:link href="http://sexysexypenguins.com/tag/puppet/feed/" rel="self" type="application/rss+xml" />
	<link>http://sexysexypenguins.com</link>
	<description>I love the smell of &#34;Free Software&#34; in the morning</description>
	<lastBuildDate>Thu, 04 Mar 2010 18:24:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Git Hooks: Making the awesomest RCS ever even better!</title>
		<link>http://sexysexypenguins.com/2009/09/30/git-hooks-making-the-awesomest-rcs-evar-even-bettar/</link>
		<comments>http://sexysexypenguins.com/2009/09/30/git-hooks-making-the-awesomest-rcs-evar-even-bettar/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 01:35:39 +0000</pubDate>
		<dc:creator>herlo</dc:creator>
				<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Guru]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[hooks]]></category>

		<guid isPermaLink="false">http://sexysexypenguins.com/?p=618</guid>
		<description><![CDATA[Over the past month or so, I&#8217;ve been really digging into git.  It&#8217;s quite the revision control system (RCS) and has some seriously awesome tools to do just about anything with your data.  My latest project has been around my semi-new job at Backcountry.com as a Senior Linux Administrator.  Essentially, my entire job right now [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past month or so, I&#8217;ve been really digging into git.  It&#8217;s quite the revision control system (RCS) and has some seriously awesome tools to do just about anything with your data.  My latest project has been around my semi-new job at <a href="http://Backcountry.com">Backcountry.com</a> as a Senior Linux Administrator.  Essentially, my entire job right now is to automate and make our infrastructure idempotent.  I am tasked with setting up cobbler, puppet, koji and other tools that will make our infrastructure more agile and scalable.</p>
<p>To do this, I&#8217;ve been using a centralized git repository using gitosis and gitweb.  Because it&#8217;s behind the Backcountry firewalls, there is no easy way to share our repository data.  However, there are some great git repos at <a href="http://github.com">github</a>, which I highly recommend.</p>
<p>Anyway, we do the hub-and-spoke model with our git repositories.  Meaning that we have a central repository where much of the data is stored so everyone can get access.  Of course, though, most people clone these repositories and work on the code where they choose.  Because we have several people pushing puppet data to our repository, which has been on subversion until 2 weeks ago, I am keen on making sure the puppet code we push to the central repo is at least syntactically valid.</p>
<h3>Git Hooks: The skinny</h3>
<p>Essentially, the key here is to understand is that git, like many other popular revision control systems is distributed.  This means that many people keep repos locally and push to the central repository after many many commits (or just one or two).  Git keeps the history in a clean way and all of the commits are pushed and tracked.  Essentially, we need some way to validate the data coming in from an outside source.  Enter <a href="http://www.kernel.org/pub/software/scm/git/docs/githooks.html">git hooks</a>.</p>
<p>There are several git hooks, but three that are quite critical to this scenario; <em>pre-commit</em>, <em>pre-receive</em> and <em>post-receive</em>.</p>
<p>The first, pre-commit is specific to the repository where the commit is taking place, such that a validation of the puppet syntax here is useful to help the person writing the puppet rules.</p>
<p>Next is post-receive which is generally useful for sending out emails after a successful push.  It would list the files and the diff of each in an email to those who wish to know about the commit.</p>
<p>And finally, the least documented of the bunch; the one with the least amount of examples, pre-receive.  The pre-receive hook has some really awesome power, but without knowing the git commands backward and forward, it can be very frustrating to get working.</p>
<h3>The value of the pre-receive hook</h3>
<p>Whenever a push is made to the centralized repository, you don&#8217;t just want to let any willy nilly commit crawl in there.  You can&#8217;t trust that the author of the commits did his part to validate the code.  So you need to at least do some basic checks.  That is what the pre-receive hook does.  In the following example, I am parsing files that end in &#8216;.pp&#8217; with puppet syntax validation as you would do from the command line.</p>
<pre>
<pre>#!/bin/bash

while read old_sha1 new_sha1 refname anothervalue ; do
    list=$(git show --pretty="format:" --name-only $new_sha1 | grep -e ".pp$")
    for tmpfile in ${list}; do
        git show ${new_sha1}:${tmpfile} | puppet --color=false --confdir=/tmp --vardir=/tmp --parseonly --ignoreimport
        if [ "$?" -ne "0" ]; then exit 1; fi
    done
done

exit $?</pre>
</pre>
<p>The above script, placed in a bare repository at hooks/pre-receive with the execute (+x) bit turned on, will get a list of files that end in &#8216;.pp&#8217; and run the puppet validator for the newest commit in the push.  Essentially, I can validate someone else&#8217;s puppet code in just a few seconds and return a failure if it doesn&#8217;t succeed.  With git hooks, a failure means no commit/push/etc will actually happen.</p>
<p>I sure hope this helps someone else to understand pre-receive hooks as well as git hooks in general.  If you have any helpful suggestions or comments, those are most welcome as well.</p>
<p>Cheers,</p>
<p>Herlo</p>
]]></content:encoded>
			<wfw:commentRss>http://sexysexypenguins.com/2009/09/30/git-hooks-making-the-awesomest-rcs-evar-even-bettar/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cancelled: SLLUG Daytime SIG: Basics of Puppet cancelled</title>
		<link>http://sexysexypenguins.com/2009/05/13/cancelled-sllug-daytime-sig-basics-of-puppet-cancelled/</link>
		<comments>http://sexysexypenguins.com/2009/05/13/cancelled-sllug-daytime-sig-basics-of-puppet-cancelled/#comments</comments>
		<pubDate>Wed, 13 May 2009 15:44:02 +0000</pubDate>
		<dc:creator>herlo</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[LUGs]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[2009]]></category>
		<category><![CDATA[puppet]]></category>

		<guid isPermaLink="false">http://sexysexypenguins.com/?p=554</guid>
		<description><![CDATA[At about 11pm last night, our presenter sent me a message indicating that there were some unresolvable conflicts and I wanted to get the word out that today&#8217;s meeting has been cancelled.  I&#8217;ll be up at the Salt Lake Public Library to hang out and chat for an hour about whatever you all want, but [...]]]></description>
			<content:encoded><![CDATA[<p>At about 11pm last night, our presenter sent me a message indicating that there were some unresolvable conflicts and I wanted to get the word out that today&#8217;s meeting has been cancelled.  I&#8217;ll be up at the Salt Lake Public Library to hang out and chat for an hour about whatever you all want, but there will be no presentation.</p>
<p>I apologize for the last minute notice.  I&#8217;m hoping to have the Basics of Puppet presentation next month.</p>
<p>Cheers,</p>
<p>Herlo</p>
]]></content:encoded>
			<wfw:commentRss>http://sexysexypenguins.com/2009/05/13/cancelled-sllug-daytime-sig-basics-of-puppet-cancelled/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Meeting: SLLUG Daytime SIG &#8211; May 13, 11:30am-1pm, Basics of Puppet</title>
		<link>http://sexysexypenguins.com/2009/05/07/meeting-sllug-daytime-sig-may-13-1130am-1pm-basics-of-puppet/</link>
		<comments>http://sexysexypenguins.com/2009/05/07/meeting-sllug-daytime-sig-may-13-1130am-1pm-basics-of-puppet/#comments</comments>
		<pubDate>Fri, 08 May 2009 01:51:16 +0000</pubDate>
		<dc:creator>herlo</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Guru]]></category>
		<category><![CDATA[LUGs]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[2009]]></category>
		<category><![CDATA[may]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[sllug]]></category>
		<category><![CDATA[utos]]></category>

		<guid isPermaLink="false">http://sexysexypenguins.com/?p=550</guid>
		<description><![CDATA[Presentation: Basics of Puppet
Presenter: Andrew Shafer

Next Wednesday, May 13 is the next SLLUG Daytime SIG meeting.  We&#8217;ll be getting a great presentation on Puppet from Andrew Shafer of Reductive Labs.  Andrew is a full-time Puppet developer and has been demonstrating the value of puppet for some time.  He lives here in Salt Lake and is [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Presentation: Basics of Puppet<br />
Presenter: Andrew Shafer<br />
</strong><br />
Next Wednesday, May 13 is the next SLLUG Daytime SIG meeting.  We&#8217;ll be getting a great presentation on Puppet from Andrew Shafer of Reductive Labs.  Andrew is a full-time Puppet developer and has been demonstrating the value of puppet for some time.  He lives here in Salt Lake and is excited to show the basics of Puppet.</p>
<p>What is Puppet?  (for the curious and uninitiated)</p>
<p>Puppet is an open-source next-generation server automation tool. It is composed of a declarative language for expressing system configuration, a client and server for distributing it, and a library for realizing the configuration.</p>
<p>More information is available here: <a href="http://reductivelabs.com/trac/puppet/wiki/FrequentlyAskedQuestions">http://reductivelabs.com/trac/puppet/wiki/FrequentlyAskedQuestions</a></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>We meet in conference room A on the lower level of the Salt Lake Library.  Head down the stairs, make a left turn.  The conference room  is directly under the foyer area (the area with all the shops on the 1st level)  If you aren’t clear, ask the information desk.</p>
<p>Also, our meetings should be posted on the Electric Signs by the entrance to the library on the first floor.</p>
<p>Cheers,</p>
<p>Herlo</p>
]]></content:encoded>
			<wfw:commentRss>http://sexysexypenguins.com/2009/05/07/meeting-sllug-daytime-sig-may-13-1130am-1pm-basics-of-puppet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
