<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[mocker.org]]></title>
  <link href="http://www.mocker.org/atom.xml" rel="self"/>
  <link href="http://www.mocker.org/"/>
  <updated>2013-04-18T22:56:50-05:00</updated>
  <id>http://www.mocker.org/</id>
  <author>
    <name><![CDATA[Kyle Sexton]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[puppet regular expression trouble]]></title>
    <link href="http://www.mocker.org/blog/2013/04/18/puppet-regular-expression-trouble/"/>
    <updated>2013-04-18T21:46:00-05:00</updated>
    <id>http://www.mocker.org/blog/2013/04/18/puppet-regular-expression-trouble</id>
    <content type="html"><![CDATA[<p>I fought an issue recently with puppet regular expressions that I thought I would share.  To understand what I was doing, consider this example fact on a server managed by puppet.</p>

<pre><code> mylist =&gt; foo:bar:baz
</code></pre>

<p>My module needed to query the server and determine if the list of things in that fact matched its list from hiera.</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='yaml'><span class='line'><span class="l-Scalar-Plain">my_list</span><span class="p-Indicator">:</span>
</span><span class='line'>      <span class="p-Indicator">-</span> <span class="s">&#39;foo&#39;</span>
</span><span class='line'><span class="err">    </span><span class="-Error">  </span><span class="p-Indicator">-</span> <span class="s">&#39;bar&#39;</span>
</span><span class='line'>      <span class="p-Indicator">-</span> <span class="s">&#39;baz&#39;</span>
</span><span class='line'><span class="err">    </span>  <span class="p-Indicator">-</span> <span class="s">&#39;qux&#39;</span>
</span></code></pre></td></tr></table></div></figure>


<p>Puppet would see <em>qux</em> as missing run the steps necessary to add it to the server.  On the next run, the fact contains <em>qux</em> so no more work is needed.</p>

<!-- more -->


<p>I spent some time working on variations of regular expression matching, but could never get it to work.</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="k">if</span> <span class="s2">&quot;${::my_list}&quot;</span> <span class="o">=~</span> <span class="sr">/$word/</span> <span class="p">{</span>
</span><span class='line'>  <span class="n">notify</span> <span class="p">{</span> <span class="s2">&quot;${::my_list} has ${word} in it&quot;</span><span class="p">:}</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'><span class="k">else</span> <span class="p">{</span>
</span><span class='line'>  <span class="n">notify</span> <span class="p">{</span> <span class="s2">&quot;${::my_list} doesn&#39;t have ${word} in it&quot;</span><span class="p">:}</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>After some research I found what I <em>think</em> was the issue.</p>

<blockquote><p>Regular expressions cannot be converted to boolean values.</p><footer><strong>Puppet Labs</strong> <cite><a href='http://docs.puppetlabs.com/puppet/3/reference/lang_datatypes.html#automatic-conversion-to-boolean'>The Puppet Language</a></cite></footer></blockquote>


<p>Luckily, <a href="https://github.com/puppetlabs/puppetlabs-stdlib">puppetlabs/stdlib</a> provides a clean way to work around that.  Using the <em>member</em> function I split <em>my_list</em> into an array, and then test if <em>word</em> is part of that array.</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="vg">$my_array</span> <span class="o">=</span> <span class="nb">split</span><span class="p">(</span><span class="vg">$:</span><span class="ss">:my_list</span><span class="p">,</span> <span class="s1">&#39;:&#39;</span><span class="p">)</span>
</span><span class='line'><span class="k">if</span> <span class="n">member</span><span class="p">(</span><span class="vg">$my_array</span><span class="p">,</span> <span class="vg">$word</span><span class="p">)</span> <span class="p">{</span>
</span><span class='line'>  <span class="n">notify</span> <span class="p">{</span> <span class="s2">&quot;${my_array} has ${word} in it&quot;</span><span class="p">:}</span>
</span><span class='line'><span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
</span><span class='line'>  <span class="n">notify</span> <span class="p">{</span> <span class="s2">&quot;${my_array} doesn&#39;t have ${word} in it&quot;</span><span class="p">:}</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[subversion with crowd authentication recap]]></title>
    <link href="http://www.mocker.org/blog/2013/04/18/subversion-with-crowd-authentication-recap/"/>
    <updated>2013-04-18T19:54:00-05:00</updated>
    <id>http://www.mocker.org/blog/2013/04/18/subversion-with-crowd-authentication-recap</id>
    <content type="html"><![CDATA[<p>In my <a href="http://www.mocker.org/blog/2013/04/01/puppetizing-crowd-authentication-into-subversion/">last post</a> I wrote about creating a simple subversion module.  The intention was to walk through the process I went through from start to finish for a new module.</p>

<p><strong>That is not going to happen.</strong>  Sorry.  There are already resources out there to teach puppet, and they are excellent.  A module I write in a day shouldn&#8217;t take weeks to write about.  At my current pace that is what is going to happen.  Instead, I&#8217;ll just describe what the module does and post the <a href="https://github.com/ksexton/puppet-subversion">code</a>.</p>

<!-- more -->


<h2>Subversion Module</h2>

<ul>
<li>Installs Subversion</li>
<li>Creates repository directory</li>
<li>Adds a facter fact to list the current repositories on the server</li>
<li>Uses Hiera for crowd specific variables and the repositories on the server</li>
</ul>


<h2>Puppetlabs Apache Module</h2>

<ul>
<li>Expanded to support auth_crowd</li>
</ul>


<h2>Code</h2>

<p>Code for the subversion module can be found <a href="https://github.com/ksexton/puppet-subversion">here</a>.  I&#8217;ll post the puppetlabs-apache code once I submit a pull request with my additions.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Puppetizing crowd authentication into subversion]]></title>
    <link href="http://www.mocker.org/blog/2013/04/01/puppetizing-crowd-authentication-into-subversion/"/>
    <updated>2013-04-01T11:30:00-05:00</updated>
    <id>http://www.mocker.org/blog/2013/04/01/puppetizing-crowd-authentication-into-subversion</id>
    <content type="html"><![CDATA[<p>In my <a href="http://www.mocker.org/blog/2013/03/29/pulp-first-impressions/">previous post</a> I wrote about using <a href="http://www.pulpproject.org">pulp</a> to host an RPM for a new puppet module.  Now I need to write that module.  First, a basic understanding of what I&#8217;m trying to accomplish.  On my target server I want to use <a href="http://www.atlassian.com/software/crowd/overview">crowd</a> to authenticate to a subversion repository.  To accomplish this I need to do the following:</p>

<ul>
<li>Install subversion</li>
<li>Install apache</li>
<li>Install Atlassian crowd apache connector (mod_authnz_crowd)</li>
</ul>


<p>The first module will be straight forward, install a package for subversion.  It will get more difficult after that because I plan on using the <a href="https://github.com/puppetlabs/puppetlabs-apache">puppetlabs/apache module</a>.  I will either need to expand their module for mod_authnz_crowd support, or write around the httpd configuration files it manages.</p>

<!-- more -->


<p>I try to use the same directory template for all of my modules.  It looks like this:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>template/
</span><span class='line'>|-- files
</span><span class='line'>|-- lib
</span><span class='line'>|-- manifests
</span><span class='line'>|-- templates
</span><span class='line'>`-- tests</span></code></pre></td></tr></table></div></figure>


<p>There is also a function in the puppet tool to create a new module using their standard, but I haven&#8217;t had luck with it.  I&#8217;m going to use my directory template to create a simple subversion module.</p>

<p>One of the things I find helpful is to document the goals of my modules before I write any code.  In this case I have a general idea of what is required because I built a test system and configured everything on it.  For subversion, I need to do the following (at least):</p>

<ul>
<li>Install subversion</li>
<li>Create repository directory</li>
</ul>


<p>Here is the code I wrote to do those things:</p>

<figure class='code'><figcaption><span>/etc/puppet/modules/subversion/manifests/init.pp  </span></figcaption>
 <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="k">class</span> <span class="n">subversion</span> <span class="p">(</span>
</span><span class='line'>  <span class="vg">$repository_dir</span>       <span class="o">=</span> <span class="o">[</span> <span class="s2">&quot;/var/&quot;</span><span class="p">,</span> <span class="s2">&quot;/var/www/&quot;</span><span class="p">,</span> <span class="s2">&quot;/var/www/svn/&quot;</span><span class="p">,</span> <span class="o">]</span><span class="p">,</span>
</span><span class='line'>  <span class="vg">$package_name</span>         <span class="o">=</span> <span class="s1">&#39;subversion&#39;</span><span class="p">,</span>
</span><span class='line'>  <span class="p">)</span> <span class="p">{</span>
</span><span class='line'>
</span><span class='line'>    <span class="kp">include</span> <span class="ss">subversion</span><span class="p">:</span><span class="ss">:install</span>
</span><span class='line'>    <span class="kp">include</span> <span class="ss">subversion</span><span class="p">:</span><span class="ss">:repository</span>
</span><span class='line'>
</span><span class='line'>  <span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>




<figure class='code'><figcaption><span>/etc/puppet/modules/subversion/manifests/install.pp  </span></figcaption>
 <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="k">class</span> <span class="ss">subversion</span><span class="p">:</span><span class="ss">:install</span> <span class="p">{</span>
</span><span class='line'>  <span class="n">package</span> <span class="p">{</span>  <span class="s2">&quot;${subversion::package_name}&quot;</span><span class="p">:</span>
</span><span class='line'>    <span class="k">ensure</span> <span class="o">=&gt;</span> <span class="n">installed</span><span class="p">,</span>
</span><span class='line'>  <span class="p">}</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>




<figure class='code'><figcaption><span>/etc/puppet/modules/subversion/manifests/repository.pp  </span></figcaption>
 <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="k">class</span> <span class="ss">subversion</span><span class="p">:</span><span class="ss">:repository</span> <span class="p">{</span>
</span><span class='line'>  <span class="n">file</span> <span class="p">{</span> <span class="vg">$subversion</span><span class="o">::</span><span class="n">repository_dir</span><span class="p">:</span>
</span><span class='line'>    <span class="k">ensure</span> <span class="o">=&gt;</span> <span class="s2">&quot;directory&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="p">}</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>The basic module works and accomplishes the goals listed above:</p>

<ul>
<li>Install subversion</li>
</ul>


<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>[root@burner ~]# rpm -qa | grep -i subversion
</span><span class='line'>subversion-1.6.11-7.el6.x86_64
</span><span class='line'>[root@burner ~]#</span></code></pre></td></tr></table></div></figure>


<ul>
<li>Create repository directory</li>
</ul>


<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>[root@burner ~]# ls -larh /var/www/svn/
</span><span class='line'>total 8.0K
</span><span class='line'>drwxr-xr-x. 3 root root 4.0K Mar 29 15:49 ..
</span><span class='line'>drwxr-xr-x. 2 root root 4.0K Mar 29 15:49 .
</span><span class='line'>[root@burner ~]#</span></code></pre></td></tr></table></div></figure>


<p>But, it leaves a lot to be desired and some things to think about:</p>

<ul>
<li> Aren&#8217;t all the cool kids using <a href="http://projects.puppetlabs.com/projects/hiera">hiera</a> now?</li>
<li> There is a directory for repositories there, should I add repository <em>creation</em> to the module?</li>
<li> Should the subversion module be expanded to install apache?</li>
</ul>


<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="k">class</span> <span class="p">{</span><span class="s1">&#39;apache::mod::mod_authnz_crowd&#39;</span><span class="p">:</span> <span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<ul>
<li> Or, should the apache module be expanded to install subversion?</li>
</ul>


<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="k">class</span> <span class="p">{</span><span class="s1">&#39;subversion::mod_authnz_crowd&#39;</span><span class="p">:</span> <span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<ul>
<li> Or something completely different?</li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Pulp First Impressions]]></title>
    <link href="http://www.mocker.org/blog/2013/03/29/pulp-first-impressions/"/>
    <updated>2013-03-29T12:40:00-05:00</updated>
    <id>http://www.mocker.org/blog/2013/03/29/pulp-first-impressions</id>
    <content type="html"><![CDATA[<h2>Prelude</h2>

<p>Today I had a task to get <a href="http://www.atlassian.com/software/crowd/overview">crowd</a> integrated with Subversion for authentication and authorization.  This was not a huge hurdle, Atlassian provides an <a href="http://downloads.atlassian.com/software/crowd/downloads/cwdapache/packages/centos5.5/mod_authnz_crowd-2.0.1-1.x86_64.rpm">RPM</a> for their crowd apache connector and the setup was straight-forward.  They do not at this time provide an RPM repository (or my half hearted search didn&#8217;t turn up anything).</p>

<!-- more -->


<p>I don&#8217;t like doing one off installations any more.  I would much rather use <a href="https://puppetlabs.com">puppet</a> to perform installation and management.  The path of least resistance would be to use the rpm provider to install and manage the RPM.  But, long term, I would much rather have an internal repository</p>

<h2>Enter Pulp</h2>

<p>There are many ways to accomplish setting up an RPM repo, but <a href="http://www.pulpproject.org">Pulp</a> seems to be the way that RHEL is moving.</p>

<h2>First impressions</h2>

<p>Because this is the first time I&#8217;ve used Pulp, some initial impressions.  Keep in mind, <em>this is with pretty much zero actual usage of the software</em>.</p>

<ul>
<li>Installation is easy</li>
<li>The documentation about which RPMs to install is a little off</li>
<li>Holy hell, it uses an AMPQ messaging engine</li>
<li>Aaaand, there seems to be an agent to install on &#8220;consumers&#8221;</li>
</ul>


<p>As an aside, I&#8217;m getting annoyed with agents on servers.  I understand why they are needed, enjoy the benefits, but hate the sprawl.  Typical servers can have agents for:</p>

<ul>
<li>monitoring</li>
<li>backup</li>
<li>puppet</li>
<li>mcollective</li>
<li>file integrity monitoring (tripwire, etc..)</li>
<li>package management?</li>
</ul>


<h2>First repository</h2>

<p><img src="http://i.imgur.com/eSd3GqJ.png"></p>

<p>Getting RHEL added into Pulp was <em>easy</em>, which I wasn&#8217;t expecting considering you have to go through a server subscription process.  I followed the instructions <a href="http://www.automation101.net/?p=33">here</a>.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>subscription-manager register
</span><span class='line'>subscription-manager refresh
</span><span class='line'>subscription-manager subscribe --auto
</span><span class='line'>
</span><span class='line'>pulp-admin rpm repo create --id=rhel-6-server --feed=https://cdn.redhat.com/content/dist/rhel/server/6/6Server/x86_64/os --feed_ca=/etc/rhsm/ca/redhat-uep.pem --feed_key=/etc/pki/entitlement/longnumber-key.pem --feed_cert=/etc/pki/entitlement/longnumber.pem
</span><span class='line'>
</span><span class='line'>pulp-admin rpm repo sync run --repo-id=rhel-6-server</span></code></pre></td></tr></table></div></figure>


<p>And it started syncing&#8230; slowly.  For the future, doing something like this seems to increase the download workers.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>pulp-admin rpm repo update --num-threads=50 --repo-id=rhel-6-server</span></code></pre></td></tr></table></div></figure>


<h2>Private repository</h2>

<p>Getting RHEL to sync is nice, but what I need for my crowd project is a private repo where I can throw the RPM.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>pulp-admin rpm repo create --repo-id=customrepo
</span><span class='line'>pulp-admin rpm repo uploads rpm --repo-id=customrepo  -f mod_authnz_crowd-2.0.1-1.x86_64.rpm</span></code></pre></td></tr></table></div></figure>


<h2>Ignoring the client.. for now</h2>

<p>The client and back end messaging engine look really great, despite what I said earlier.  But I want to get a good feel for pulp before deploying an agent to all my machines.  First I tried just adding the repo to /etc/yum.repos.d:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>[root@testserver yum.repos.d]# cat private.repo 
</span><span class='line'>[customrepo]
</span><span class='line'>name=Custom Repository
</span><span class='line'>baseurl=https://pulp.private.lan/pulp/repos/customrepo
</span><span class='line'>enabled=1
</span><span class='line'>gpgcheck=0
</span><span class='line'>[root@testserver yum.repos.d]#</span></code></pre></td></tr></table></div></figure>


<p>But that complained with an error about certificates.  My initial guess is the server wants the pulp agent to register with it.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>[Errno 14] Peer cert cannot be verified or peer cert invalid
</span><span class='line'>Trying other mirror.</span></code></pre></td></tr></table></div></figure>


<p>My work around was simply to remove the https requirement from the repo.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>pulp-admin rpm repo update --repo-id=customrepo --serve-http=true
</span><span class='line'>pulp-admin rpm repo publish run --repo-id=customrepo</span></code></pre></td></tr></table></div></figure>


<p>Switched the repo on the server to http and it&#8217;s able to communicate and pull the RPM I uploaded.</p>

<h2>Things left to do</h2>

<p>That gets me to the point of working on the puppet module for crowd, but pulp is a much larger project than I expected so I have more to do.</p>

<ul>
<li>Determine if the certificate error is due to requiring the agent</li>
<li>Explore the features of the pulp agent to see if it&#8217;s worth pursuing</li>
<li>Add the RHEL repository I created to a test machine and play with using it instead of Red Hat</li>
<li>Setup automatic syncing of repositories</li>
<li>Switch back to SSL</li>
<li>Add the Red Hat &#8220;optional&#8221; channel as synchronized repositories</li>
<li>Play with adding a puppet module repository and figure out how that impacts my current version controlled release pattern</li>
</ul>


<p>More I&#8217;m sure, but that&#8217;s a good start.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Desktop Theme]]></title>
    <link href="http://www.mocker.org/blog/2012/11/16/desktop-theme/"/>
    <updated>2012-11-16T00:00:00-06:00</updated>
    <id>http://www.mocker.org/blog/2012/11/16/desktop-theme</id>
    <content type="html"><![CDATA[<p>Stayed up late last night and customized the look of my terminal. Took longer than I wanted, but I like the results.  Went with solarized-dark for everything, with manual tweaking to get the colors how I want them.<br/>
<a href="http://i.imgur.com/3s79s.png"><img class="alignnone" title="Desktop Screenshot" src="http://i.imgur.com/3s79s.png" alt="" width="1694" height="1064" /></a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to setup a test environment on Mac OS X in VirtualBox]]></title>
    <link href="http://www.mocker.org/blog/2012/07/27/how-to-setup-a-test-environment-on-mac-os-x-in-virtualbox/"/>
    <updated>2012-07-27T00:00:00-05:00</updated>
    <id>http://www.mocker.org/blog/2012/07/27/how-to-setup-a-test-environment-on-mac-os-x-in-virtualbox</id>
    <content type="html"><![CDATA[<!-- Start ScreenSteps Content -->




<div class="LessonContent">
  <div class="LessonSummary">
    <p>
      An ideal test environment is unique to the person who uses it, and what they need. My default option of VMWare Fusion started hampering what I wanted to accomplish due to it’s lack of any advanced networking features. Here is how I configured VirtualBox on Mac OS X to have multiple private networks using “Host-only Adapters” that are still able to communicate with the outside world. I’ve done this mainly for my puppet development because it’s nice to have completely separate networks where I control everything.
    </p>
  </div>
  
  <p>
    <!--more-->
  </p>
  
  <div class="LessonStep top">
    <h3 class="StepTitle" style="font-size: 20px;">
      Create a new host-only network
    </h3>
    
    <div class="StepImage" style="margin: 10px 0px;">
      <img style="padding: 3px; border: 1px solid #ccc;" src="http://www.mocker.org/images/2012/07/wpid79-wpid-media_1343358158433.png" alt="wpid79-wpid-media_1343358158433.png" width="532" height="386" />
    </div>
  </div>
  
  <div class="LessonStep top">
    <h3 class="StepTitle" style="font-size: 20px;">
      Edit network
    </h3>
    
    <div class="StepImage" style="margin: 10px 0px;">
      <img style="padding: 3px; border: 1px solid #ccc;" src="http://www.mocker.org/images/2012/07/wpid81-wpid-media_1343358263954.png" alt="wpid81-wpid-media_1343358263954.png" width="532" height="386" />
    </div>
  </div>
  
  <div class="LessonStep top">
    <h3 class="StepTitle" style="font-size: 20px;">
      Setup the IP range you would like to use for your network
    </h3>
    
    <div class="StepImage" style="margin: 10px 0px;">
      <img style="padding: 3px; border: 1px solid #ccc;" src="http://www.mocker.org/images/2012/07/wpid83-wpid-media_1343358390800.png" alt="wpid83-wpid-media_1343358390800.png" width="532" height="255" />
    </div>
    
    <div class="StepInstructions">
    </div>
  </div>
  
  <div class="LessonStep top">
    <h3 class="StepTitle" style="font-size: 20px;">
      Edit your virtual machine settings
    </h3>
    
    <div class="StepImage" style="margin: 10px 0px;">
      <img style="padding: 3px; border: 1px solid #ccc;" src="http://www.mocker.org/images/2012/07/wpid82-wpid-media_1343358610704.png" alt="wpid82-wpid-media_1343358610704.png" width="532" height="440" />
    </div>
  </div>
  
  <div class="LessonStep top">
    <h3 class="StepTitle" style="font-size: 20px;">
      Add your virtual machine to the host-only network
    </h3>
    
    <div class="StepImage" style="margin: 10px 0px;">
      <img style="padding: 3px; border: 1px solid #ccc;" src="http://www.mocker.org/images/2012/07/wpid76-wpid-media_1343358703763.png" alt="wpid76-wpid-media_1343358703763.png" width="532" height="440" />
    </div>
  </div>
  
  <div class="LessonStep top">
    <h3 class="StepTitle" style="font-size: 20px;">
      Determine which interface is active on your workstation
    </h3>
    
    <div class="StepImage" style="margin: 10px 0px;">
      <img style="padding: 3px; border: 1px solid #ccc;" src="http://www.mocker.org/images/2012/07/wpid80-wpid-media_1343358916433.png" alt="wpid80-wpid-media_1343358916433.png" width="532" height="518" />
    </div>
    
    <div class="StepInstructions">
      <ol>
        <li>
          In a terminal on your workstation, run the ifconfig command
        </li>
        <li>
          Locate which interface has your IP address
        </li>
        <li>
          Remember the interface name for the next step, in this case it’s <strong>en1</strong>
        </li>
      </ol>
    </div>
  </div>
  
  <div class="LessonStep top">
    <h3 class="StepTitle" style="font-size: 20px;">
      Bridge your workstation network to the host-only network
    </h3>
    
    <div class="StepImage" style="margin: 10px 0px;">
      <img style="padding: 3px; border: 1px solid #ccc;" src="http://www.mocker.org/images/2012/07/wpid77-wpid-media_1343359580718.png" alt="wpid77-wpid-media_1343359580718.png" width="532" height="95" />
    </div>
    
    <div class="StepInstructions">
      <p>
        Run these commands in the terminal, substituting en1 for the interface found in the previous step
      </p>
      
      <ol>
        <li>
          sudo sysctl -w net.inet.ip.forwarding=1
        </li>
        <li>
          sudo natd -interface en1
        </li>
        <li>
          sudo ipfw add divert natd ip from any to any via en1
        </li>
      </ol>
    </div>
  </div>
  
  <div class="LessonStep top">
    <h3 class="StepTitle" style="font-size: 20px;">
      Configure networking on virtual machines
    </h3>
    
    <div class="StepImage" style="margin: 10px 0px;">
      <img style="padding: 3px; border: 1px solid #ccc;" src="http://www.mocker.org/images/2012/07/wpid78-wpid-media_1343394884869.png" alt="wpid78-wpid-media_1343394884869.png" width="532" height="435" />
    </div>
    
    <div class="StepInstructions">
      <p>
        Configure your guests to use the new network setup. Since I used 192.168.100.1 for my host adapter, I have the following configuration for my guest:
      </p>
      
      <p>
        IP Address: 192.168.100.2<br /> Netmask: 255.255.255.0<br /> Gateway: 192.168.100.1
      </p>
    </div>
  </div>
  
  <div class="LessonStep top">
    <h3 class="StepTitle" style="font-size: 20px;">
      Next steps
    </h3>
    
    <div class="StepInstructions">
      <p>
        Now that you have a private network some things that I add are:
      </p>
      
      <ul>
        <li>
          Name Server, I like to have a private zone just for my labs ( razor.tardis.lab )
        </li>
        <li>
          Puppet, automate and develop configurations for my guests
        </li>
      </ul>
    </div>
  </div>
</div>




<!-- End ScreenSteps Content -->

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Skeleton configuration for managing multiple sites in puppet]]></title>
    <link href="http://www.mocker.org/blog/2012/07/25/skeleton-configuration-for-managing-multiple-sites-in-puppet/"/>
    <updated>2012-07-25T00:00:00-05:00</updated>
    <id>http://www.mocker.org/blog/2012/07/25/skeleton-configuration-for-managing-multiple-sites-in-puppet</id>
    <content type="html"><![CDATA[<p><img class="right" src="http://www.mocker.org/images/2012/07/Puppet-Labs-Logo-Vertical-Sm.png" width="70"></p>

<p>I created a skeleton configuration for managing multiple locations in puppet and pushed it to github. You can find the repository <a href="https://github.com/ksexton/puppet-sites">here</a>.</p>

<p>Two sites are defined, Earth and Mars. Parameters for each site are defined in <em>site/manifests/earth/params.pp</em> and <em>site/manifests/mars/params.pp</em>. Included are two modules ntp and user to demonstrate configuring modules across sites.</p>

<p>I also sent a message to puppet-users to get feedback on the methods I used. If I hear improved ways to do this type of setup I’ll update the repository.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Install updated git version on RHEL6]]></title>
    <link href="http://www.mocker.org/blog/2012/07/24/install-updated-git-version-on-rhel6/"/>
    <updated>2012-07-24T00:00:00-05:00</updated>
    <id>http://www.mocker.org/blog/2012/07/24/install-updated-git-version-on-rhel6</id>
    <content type="html"><![CDATA[<p><a href="http://www.github.com">Github</a> doesn’t support the version of git that comes with RHEL6. Here are the commands I used to get a supported version installed:</p>

<pre class="brush: plain; title: ; notranslate" title="">$ sudo rhn-channel --add --channel=rhel-x86_64-server-optional-6
$ sudo yum install http://pkgs.repoforge.org/git/git-1.7.11.1-1.el6.rfx.x86_64.rpm http://pkgs.repoforge.org/git/perl-Git-1.7.11.1-1.el6.rfx.x86_64.rpm
</pre>


<p>The annoying part to this was finding the rhn-channel command to enable the optional repo. Most places I looked online wanted me to do this</p>

<pre class="brush: plain; title: ; notranslate" title="">yum --enablerepo=rhel-6-server-optional-rpms
</pre>


<p>but my RHEL server wasn’t subscribed to that channel for it to be enabled.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Project Concept: Achievements]]></title>
    <link href="http://www.mocker.org/blog/2012/03/09/project-concept-achievements/"/>
    <updated>2012-03-09T00:00:00-06:00</updated>
    <id>http://www.mocker.org/blog/2012/03/09/project-concept-achievements</id>
    <content type="html"><![CDATA[<p>I get project ideas all the time, this one came at 2:33am according to the task in OmniFocus. It’s beyond my coding ability, but I think it’s a decent idea.</p>

<p>If you think so too, let me know and we’ll code some stuff up! Or, if this already exists and I haven’t heard of the site let me know.</p>

<p><strong><em>Begin Elevator Pitch (in car salesman like voice):</em></strong></p>

<p>Achievements, the “gamification” of the web, are poised to become the next big thing. Microsoft even recently added earning achievements to the next release of Visual Studio.</p>

<p>I propose a centralized place, much like gravatar, that would allow developers to easily add achievements to their site. Users benefit because they have one place to keep track of all their “badges” and unlockable content.</p>

<p>(all of these based on user and site preference)</p>

<ul>
<li>Site can administrators easily add and track new achievements by using API or portal</li>
<li>User achievements/badges could be shared among sites</li>
<li>Posting of newly earned badges across all sites to twitter/facebook/etc..</li>
<li>Linked to email address, no real “authentication” needed</li>
<li>Increase site visibility because badges for your site would show up on other site user profiles</li>
<li>Increase user interactions as they compete for badges</li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Sending files using DNS]]></title>
    <link href="http://www.mocker.org/blog/2012/02/23/sending-files-using-dns/"/>
    <updated>2012-02-23T00:00:00-06:00</updated>
    <id>http://www.mocker.org/blog/2012/02/23/sending-files-using-dns</id>
    <content type="html"><![CDATA[<p>Today I pushed an app I’ve been working on to a public git repo <a href="http://sendtodns.github.com/">here</a>. The project allows people to share files using DNS. A file is pushed to an authoritative name server and can be pulled back down with a file key. If it’s pulled back down from someone’s normal name servers, it will (depending on DNS server settings) be cached on that name server. Subsequent pulls from that name server won’t need to hit the authoritative name server for records as long as it’s cached (usually TTL, sometimes not).</p>

<p>I think the idea is fun, and I’ve been able to pull down an Ubuntu ISO using only DNS as my source. I did a call for help on reddit for people to give suggestions on cleaning up my code and already have four pull requests. Still have quite a few things I’d like to add, at the top of my list is a rails app that would allow a user to upload a file and have it pushed to DNS records.</p>

<p>Check it out, make fun of my code, and tell anyone you think might be interested.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Batching of forked processes in ruby]]></title>
    <link href="http://www.mocker.org/blog/2012/02/20/batching-of-forked-processes-in-ruby/"/>
    <updated>2012-02-20T00:00:00-06:00</updated>
    <id>http://www.mocker.org/blog/2012/02/20/batching-of-forked-processes-in-ruby</id>
    <content type="html"><![CDATA[<p>Sometimes the fun in not being a full-time (or good) programmer is coming up with odd solutions to problems that a real programmer would scoff/laugh at. Recently I had to devise a way to power through a huge number of processes in one of my scripts, without fork bombing my system. I came up with using the modulus operator and Process.waitall to force my script to halt after a batch of jobs started.</p>

<pre class="brush: ruby; title: ; notranslate" title="">batch_incrementor = 0
batch_size = 10

50.times do |i|

  fork do
    puts i
    sleep 10
  end
  
  batch_incrementor += 1
  
  if (batch_incrementor/batch_size.to_f)%1 == 0.0
    Process.waitall
  end
  
end
</pre>


<p>I’m sure this method isn’t original or new, just new to me. <img src='http://www.mocker.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>

<p>If any real programmers read this and have better ways, please let me know! I’m always ready to learn more.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Forcing an old Polycom to update the stored contact list]]></title>
    <link href="http://www.mocker.org/blog/2012/02/17/forcing-an-old-polycom-to-update-the-stored-contact-list/"/>
    <updated>2012-02-17T00:00:00-06:00</updated>
    <id>http://www.mocker.org/blog/2012/02/17/forcing-an-old-polycom-to-update-the-stored-contact-list</id>
    <content type="html"><![CDATA[<p><img src="http://i.imgur.com/OBt2Z.png" alt="" title="" border="0" width="" height="" style="float:right;" /><br/>
Was having an issue with some old Polycom phones not wanting to pull down a new contact list from the server. Quick fix that I found was updating volatile memory settings to from zero to one.</p>

<p>From the <a href="http://bit.ly/zZF2IO">Polycom SIP 2.0 Administrator’s Guide</a></p>

<blockquote><p>If set to 1, use volatile storage for phone-resident copy of the directory to allow for larger size.</p></blockquote>

<p>Keep in mind that all of these settings are wrapped in XML. Don’t remove any of that formatting, just change these values in the XML.</p>

<p>Before they were changed in sip.cfg</p>

<pre class="brush: plain; title: ; notranslate" title="">dir.local.volatile.2meg="0"
dir.local.volatile.4meg="0"
dir.local.volatile.8meg="0"
</pre>


<p>After they were changed in sip.cfg</p>

<pre class="brush: plain; title: ; notranslate" title="">dir.local.volatile.2meg="1"
dir.local.volatile.4meg="1"
dir.local.volatile.8meg="1"
</pre>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Supporting breast cancer awareness could raise your insurance rates]]></title>
    <link href="http://www.mocker.org/blog/2012/02/14/supporting-breast-cancer-awareness-could-raise-your-insurance-rates/"/>
    <updated>2012-02-14T00:00:00-06:00</updated>
    <id>http://www.mocker.org/blog/2012/02/14/supporting-breast-cancer-awareness-could-raise-your-insurance-rates</id>
    <content type="html"><![CDATA[<p>Is that a sensationalist headline or what?</p>

<p>A coworker and I had a discussion over lunch that had me thinking about digital privacy. A digital profile is the aggregate information that is collected about your online activities. What our “digital profile” says about us and what it can be used for is both entertaining and scary. The entertaining part is coming up with fictional scenarios that could happen, the scary part is that the scenarios could be happening now.</p>

<p><strong>Cue twilight zone narration voice</strong></p>

<p><strong><em>Scenario 1:</em></strong><br/>
A health insurance company is trying to lower rates for customers. By profiling customer’s search history and social network information they can more accurately place people into high or low risk categories and determine what rates they should pay. For customers that have opted for a *private* social network, information is pulled from their “Friends” who have public data and a profile is built based upon aggregate friend information. As the program continues, more information is gathered about the users. Suddenly someone who posts something supporting breast cancer awareness is in a higher risk category because of an increased probability they are related to someone with cancer.</p>

<p><strong><em>Scenario 2:</em></strong><br/>
A car insurance company is trying (again) to lower rates for customers. They use the same methods above but also found that with cell phone GPS they can accurately take snapshots of how fast the customer is driving. Suddenly someone who has been a safe driver under the previous system that drives 10 miles over the speed limit is bumped to a riskier category.</p>

<p>It easy to come up with scenarios once you get started:</p>

<ul>
<li>Hiring (or firing)</li>
<li>Getting added to a “no fly list”</li>
<li>Loan applications</li>
<li>Legal cases (think divorce, paternity)</li>
<li>Identity theft</li>
<li>Benefits claims (based on some activity you post, contesting eligibility for benefits)</li>
</ul>


<p>So should you try to hide your identity on the Internet? Personally, I would rather have privacy laws in place that protect user data. I don’t want a world where only sophisticated users can protect their information. I don’t want to hide in an Internet cave battling new ways to collect information about me. I enjoy using the new social services that are coming out. Perhaps I’m naive.</p>

<p>Some links to check out:</p>

<ul>
<li><a href="http://www.eff.org">EFF</a></li>
<li><a href="http://www.google.com/intl/en/policies/privacy/preview/">Google’s upcoming privacy policy</a></li>
<li><a href="http://www.facebook.com/about/privacy/">Facebook privacy policy</a></li>
<li><a href="http://en.wikipedia.org/wiki/International_Safe_Harbor_Privacy_Principles">International Safe Harbor Privacy Principles</a></li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[bash functions for Asterisk]]></title>
    <link href="http://www.mocker.org/blog/2012/02/12/bash-functions-for-asterisk/"/>
    <updated>2012-02-12T00:00:00-06:00</updated>
    <id>http://www.mocker.org/blog/2012/02/12/bash-functions-for-asterisk</id>
    <content type="html"><![CDATA[<p>I’ve started to cobble together some bash functions to help with common Asterisk administration tasks. Here is a useful snippet for getting free sip users from your sip.conf. If you are on a CentOS box you can put this in /etc/profile.d/asterisk.sh to make it available to everyone on the system.</p>

<pre class="brush: bash; title: ; notranslate" title=""># Free SIP extensions
# Usage: freesip /etc/asterisk/sip.conf 200 299

freesip() {
  comm -2 &lt;(seq $2 $3) &lt;(cat $1 | grep ^\[ | sort | uniq | tr -d [ | tr -d ]) | grep ^[[:digit:]]
}
</pre>




<pre class="brush: plain; title: ; notranslate" title="">$ freesip /etc/asterisk/sip.conf 200 299
200
201
233
245
$
</pre>

]]></content>
  </entry>
  
</feed>
