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

  <title><![CDATA[dewey.ws]]></title>
  <link href="http://dewey.ws/atom.xml" rel="self"/>
  <link href="http://dewey.ws/"/>
  <updated>2012-05-06T20:59:41-07:00</updated>
  <id>http://dewey.ws/</id>
  <author>
    <name><![CDATA[retr0h]]></name>
    <email><![CDATA[blog@dewey.ws]]></email>
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[ohai plugins]]></title>
    <link href="http://dewey.ws/blog/2012/05/06/ohai-plugins/"/>
    <updated>2012-05-06T18:41:00-07:00</updated>
    <id>http://dewey.ws/blog/2012/05/06/ohai-plugins</id>
    <content type="html"><![CDATA[<p>I have become quite a fan of <a href="https://github.com/opscode/ohai">Ohai</a> plugins.  <a href="https://bitbucket.org/retr0h/ohai/overview">My plugins</a> can be found on <a href="https://bitbucket.org/">bitbucket</a>.</p>

<p>Remember to be cautious with the amount of data the plugins generate.  For those of you running your own <a href="http://wiki.opscode.com/display/chef/Chef+Server">Chef Server</a>, you can easily exhaust solr&#8217;s maxFieldLength.  This will result in various clients not returning in search results.  Have a look at this <a href="http://tickets.opscode.com/browse/CHEF-2346">bug</a>.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[infrastructure testing with minitest]]></title>
    <link href="http://dewey.ws/blog/2012/04/02/infrastructure-testing-with-minitest/"/>
    <updated>2012-04-02T16:49:00-07:00</updated>
    <id>http://dewey.ws/blog/2012/04/02/infrastructure-testing-with-minitest</id>
    <content type="html"><![CDATA[<p>Having written a lot of non-infrastructure tests in the past, I have felt a deep desire to write tests for infrastructure provisioning we are working on.</p>

<p>Not being a fan of <a href="http://cukes.info/">Cucumber</a> or <a href="http://rspec.info/">RSpec</a>, decided to use <a href="https://github.com/delano/rye">Rye</a> with <a href="https://github.com/seattlerb/minitest">MiniTest</a> for assertions.</p>

<p>Below is an example of how to use Rye with MiniTest.  The tests are invoked over SSH, and can optionally be run through a &#8220;jump host&#8221;.  The tests are a bit contrived, but verify Chef was installed/configured properly.  The tests are easy to understand and update, which is key.  Not everyone who builds infrastructure has used Cucumber or test suites, even in this age of DevOps.  IMO, this method provides a reasonable way to get up to speed with Ruby and testing, while adding value (tests).</p>

<div><script src='https://gist.github.com/2288122.js?file='></script>
<noscript><pre><code>source &quot;http://rubygems.org&quot;

group :test, :development do
  gem &quot;rake&quot;, &quot;~&gt; 0.9.2.2&quot;
  gem &quot;rye&quot;,  &quot;~&gt; 0.9.5&quot;
end</code></pre></noscript></div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[creating PTR records with dynect_rest]]></title>
    <link href="http://dewey.ws/blog/2012/03/10/creating-ptr-records-with-dynect-rest/"/>
    <updated>2012-03-10T11:49:00-08:00</updated>
    <id>http://dewey.ws/blog/2012/03/10/creating-ptr-records-with-dynect-rest</id>
    <content type="html"><![CDATA[<p>Recently I wanted to create forward and reverse DNS for specific chef nodes.  Using the <a href="http://community.opscode.com/cookbooks/dynect">dynect</a> community cookbook, resulted in the following gist.</p>

<div><script src='https://gist.github.com/2010483.js?file='></script>
<noscript><pre><code>dynect_rr &quot;creating reverse dns for #{node['hostname']}-pub&quot; do                                                                                                               
  record_type &quot;PTRRecord&quot;  
  rdata       ({ &quot;ptrdname&quot; =&gt; &quot;foo.example.com&quot; })
  fqdn        &quot;40.30.20.10.in-addr.arpa&quot;
  customer    dynect_creds['cn']  
  username    dynect_creds['user']
  password    dynect_creds['password'] 
  zone        &quot;30.10.10.in-addr.arpa&quot;

  action      :create      
end</code></pre></noscript></div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[lldp discovery with chef and ohai]]></title>
    <link href="http://dewey.ws/blog/2012/03/05/lldp-discovery-with-chef-and-ohai/"/>
    <updated>2012-03-05T12:15:00-08:00</updated>
    <id>http://dewey.ws/blog/2012/03/05/lldp-discovery-with-chef-and-ohai</id>
    <content type="html"><![CDATA[<p>In a continued attempt to add additional <a href="http://sourceforge.net/apps/trac/nventory/wiki">nventory</a> type information about our systems, the following <a href="https://bitbucket.org/retr0h/ohai/src/3dab0ebb3a9d/lldp.rb">Ohai plugin</a> plugin can be used to collect a system&#8217;s <a href="http://en.wikipedia.org/wiki/Link_Layer_Discovery_Protocol">LLDP</a> information.</p>

<p>The <a href="http://wiki.opscode.com/display/chef/Community+Plugins">community</a> page already has such a <a href="https://github.com/demonccc/chef-repo/blob/master/plugins/ohai/linux/ladvd.rb">plugin</a>, but the systems we are using experience odd behavior when running <a href="http://code.google.com/p/ladvd/">ladvd</a>.  Plus who doesn&#8217;t want an excuse to write recursive code. :)</p>

<p>Usage is as follows:</p>

<div><script src='https://gist.github.com/1980881.js?file='></script>
<noscript><pre><code>$ knife search node &quot;name:o5r1*&quot; -a lldp.eth2
1 items found

id:         o5r1
lldp.eth2: 
  age:      3 days, 14:38:13
  chassis: 
    Bridge:  
      enabled:  on
    Router:  
      enabled:  off
    descr:    Arista Networks EOS version 4.8.3 running on an Arista Networks DCS-7124SX
    mac:      aa:bb:cc:dd:ee:ff
    mgmt-ip:  192.168.0.108
    name:     xx-R1
  port:    
    aggregation:  1000052
    descr:        Not received
    ifname:       Ethernet2
    mfs:          9236
  rid:      4
  via:      LLDP
  vlan:    
    pvid:     yes
    vlan-id:  1
</code></pre></noscript></div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[moved to bitbucket]]></title>
    <link href="http://dewey.ws/blog/2012/03/03/moved-to-bitbucket/"/>
    <updated>2012-03-03T13:08:00-08:00</updated>
    <id>http://dewey.ws/blog/2012/03/03/moved-to-bitbucket</id>
    <content type="html"><![CDATA[<p>Obviously we all love <a href="http://github.com/">github</a>.  I found myself needing a lot of private repositories.  I opted to go with <a href="https://bitbucket.org/">bitbucket</a>.  I plan to privately prototype in bitbucket for things I am not ready to release, and push to github for official release.  Taking advantage of issue tracking, pull request functionality, and the larger community.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[ipmi address discovery with chef and ohai]]></title>
    <link href="http://dewey.ws/blog/2012/03/03/ipmi-address-discovery-with-chef-and-ohai/"/>
    <updated>2012-03-03T11:03:00-08:00</updated>
    <id>http://dewey.ws/blog/2012/03/03/ipmi-address-discovery-with-chef-and-ohai</id>
    <content type="html"><![CDATA[<p>A simple <a href="https://bitbucket.org/retr0h/ohai/src/9ddb46e50a0d/ipmi.rb">Ohai plugin</a> plugin to collect a metal system&#8217;s IPMI address.
Debian systems require the &#8216;ipmitool&#8217; package and the following modules loaded.</p>

<div><script src='https://gist.github.com/1967761.js?file='></script>
<noscript><pre><code>if ! grep ipmi /etc/modules &gt; /dev/null; then
    echo ipmi_si &gt;&gt; /etc/modules
    echo ipmi_devintf &gt;&gt; /etc/modules
fi</code></pre></noscript></div>


<p>Usage is as follows:</p>

<div><script src='https://gist.github.com/1967771.js?file='></script>
<noscript><pre><code>$ knife search node 'name:o4r1*' -a ipmi
1 items found

id:    o4r1.example.com
ipmi: 
  address:      172.16.5.13
  mac_address:  e8:9a:8f:a0:32:57</code></pre></noscript></div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Public IP Address Discovery With Chef and Ohai]]></title>
    <link href="http://dewey.ws/blog/2011/10/27/public-ip-address-discovery-with-chef-and-ohai/"/>
    <updated>2011-10-27T22:01:00-07:00</updated>
    <id>http://dewey.ws/blog/2011/10/27/public-ip-address-discovery-with-chef-and-ohai</id>
    <content type="html"><![CDATA[<p>I am currently automating the deployment and configuration of a moderately complex service architecture.  <a href="https://github.com/opscode/ohai">Ohai</a>, currently has no way to discover a systems public (floating) ip address in an <a href="http://www.openstack.org/">OpenStack</a> environment.  The ability to discover this information helps with additional automation (eg. Provisioning dns in <a href="http://dyn.com/">DynECT</a>).</p>

<p>This <del><a href="https://github.com/retr0h/ohai/blob/master/floating_plugin.rb">Ohai plugin</a></del> <a href="https://bitbucket.org/retr0h/ohai/src/43c1921a80a4/floating_plugin.rb">Ohai plugin</a> is a semi-poor attempt at discovering a guest&#8217;s public ipaddress.</del></p>

<p><strong>Update: Sat March 3 2011</strong></p>

<p>Looks like Ohai already attempts to capture this information from the meta-data server.  However, this fails due to MAC address not matching.  Updated the previously discussed plugin to capture the floating IP from the meta-data server.  <del>Also, have it following the same API as the eucalyptus plugin.</del></p>

<p>Usage is as follows:</p>

<div><script src='https://gist.github.com/1399227.js?file='></script>
<noscript><pre><code>$ knife search node 'name:i-0000010f' -a eucalyptus.public_ipv4
1 items found

eucalyptus.public_ipv4:  XX.55.66.48
id:                      i-0000010f</code></pre></noscript></div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Zkpython and Homebrew]]></title>
    <link href="http://dewey.ws/blog/2011/08/29/zkpython-and-homebrew/"/>
    <updated>2011-08-29T22:54:00-07:00</updated>
    <id>http://dewey.ws/blog/2011/08/29/zkpython-and-homebrew</id>
    <content type="html"><![CDATA[<p>Ran into the following error on OSX, when trying to pip install a <a href="https://github.com/mxcl/homebrew">Homebrew</a> installed version of <a href="http://zookeeper.apache.org/">ZooKeeper</a>&#8217;s zkpython.</p>

<pre><code>zookeeper.c:20:23: error: zookeeper.h: No such file or directory
</code></pre>

<p>Was able to install by providing the &#8216;C_INCLUDE_PATH&#8217; to pip.</p>

<div><script src='https://gist.github.com/1117566.js?file='></script>
<noscript><pre><code>BREW_HOME=$HOME/.homebrew

    $ brew install zookeeper
    $ C_INCLUDE_PATH=${BREW_HOME}/Cellar/zookeeper/3.3.3/include/c-client-src/ pip install zkpython</code></pre></noscript></div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Using Netcat to Open Ports]]></title>
    <link href="http://dewey.ws/blog/2011/08/14/using-netcat-to-open-ports/"/>
    <updated>2011-08-14T20:58:00-07:00</updated>
    <id>http://dewey.ws/blog/2011/08/14/using-netcat-to-open-ports</id>
    <content type="html"><![CDATA[<p>I find it useful to easily open a port, to test access controls.  Configuring a webserver or iptables to redirect to a known running port is cumbersome.  The following has proved useful many times.</p>

<pre><code>$ echo "open port" |nc -l 8080
</code></pre>

<p>Verification can be done with telnet or netcat.</p>

<pre><code>$ telnet example.com 8080
Trying example.com...
Connected to example.com.
Escape character is '^]'.
open port
Connection closed by foreign host.

$ nc example.com 8080
open port
</code></pre>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Nokogiri RVM Homebrew]]></title>
    <link href="http://dewey.ws/blog/2011/08/13/nokogiri-rvm-homebrew/"/>
    <updated>2011-08-13T14:45:00-07:00</updated>
    <id>http://dewey.ws/blog/2011/08/13/nokogiri-rvm-homebrew</id>
    <content type="html"><![CDATA[<p>Having problems getting <a href="http://nokogiri.org/">Nokogiri</a> to compile on OSX with <a href="https://github.com/mxcl/homebrew">Homebrew</a>?</p>

<div><script src='https://gist.github.com/1001477.js?file='></script>
<noscript><pre><code>BREW_HOME=$HOME/.homebrew

$ brew install libxml2
$ brew link libxml2
$ brew install https://github.com/adamv/homebrew-alt/raw/master/duplicates/libxslt.rb
$ brew link libxslt
$ brew install libiconv
$ brew link libiconv
$ gem install nokogiri -- --with-xml2-dir=$BREW_HOME/Cellar/libxml2/2.7.8 --with-xslt-dir=$BREW_HOME/Cellar/libxslt/1.1.26 --with-iconv-dir=$BREW_HOME/Cellar/libiconv/1.13.1/</code></pre></noscript></div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Openstack Image Uploader]]></title>
    <link href="http://dewey.ws/blog/2011/08/13/openstack-image-uploader/"/>
    <updated>2011-08-13T14:03:00-07:00</updated>
    <id>http://dewey.ws/blog/2011/08/13/openstack-image-uploader</id>
    <content type="html"><![CDATA[<p>My co-worker and best pal <a href="https://twitter.com/kevinbringard">Kevin</a> wrote a <a href="https://github.com/kevinbringard/OpenStack-tools/blob/master/glance-uploader.bash">script</a> to upload images into <a href="http://www.openstack.org/">OpenStack&#8217;s </a> <a href="https://launchpad.net/glance">Glance</a>.  He recently released the script as the <a href="https://github.com/kevinbringard/ogler">ogler</a> rubygem.  It is a straight forward script, built on the <a href="https://github.com/kevinbringard/ogle">ogle</a> library.  Our friends at <a href="http://www.opscode.com/">Opscode</a> contacted Kevin, and are planning to distribute it in some fashion.</p>

<p>Uploading directly into Glance allows the setting of <a href="http://glance.openstack.org/glanceapi.html">metadata</a>, it also avoids the unnecessary steps behind &#8216;euca-bundle-image&#8217; (<a href="https://launchpad.net/swift">object store</a> upload -> unbundle -> Glance upload).</p>

<h2>Usage</h2>

<p>Install the rubygem:</p>

<pre><code>$ gem install ogler
</code></pre>

<p>To upload a x86_64 Ubuntu 11.04 ami and 2.6.35 aki:</p>

<pre><code>$ ogler -i &lt;ami&gt; -k &lt;aki&gt; -a x86_64 -e 2.6.35 -d ubuntu -v 11.04 -h &lt;Glance endpoint&gt;
</code></pre>

<p>Attaching additional metadata is as simple as appending key/value pairs:</p>

<pre><code>-c foo=bar,baz=qux
</code></pre>

<p>Glance uses decimal ids.  <a href="https://launchpad.net/nova">Nova</a> converts them to standard ami ids you&#8217;re used to, when queried through the EC2 API.  To view the metadata we query Glance for the image id:</p>

<pre><code>$ curl -i -X HEAD localhost:9292/v1.0/images/4
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: 0
X-Image-Meta-Property-Distro: Ubuntu
X-Image-Meta-Id: 4
X-Image-Meta-Property-Arch: amd64
X-Image-Meta-Deleted: False
X-Image-Meta-Container_format: ami
X-Image-Meta-Property-Uploader: root@enc1b11
X-Image-Meta-Location: file:///var/lib/glance/images/4
X-Image-Meta-Deleted_at: 
X-Image-Meta-Created_at: 2011-05-11T15:48:02
X-Image-Meta-Size: 1476395008
X-Image-Meta-Status: active
X-Image-Meta-Property-Type: machine
X-Image-Meta-Property-Kernel_name: natty-server-uec-amd64-vmlinuz-virtual
X-Image-Meta-Is_public: True
X-Image-Meta-Property-Kernel_id: 3
X-Image-Meta-Updated_at: 2011-05-11T15:48:08
X-Image-Meta-Checksum: b6149317c554d2c335365e7bd43e9bf0
X-Image-Meta-Property-Version: 11.04
X-Image-Meta-Disk_format: ami
X-Image-Meta-Name: ubuntu_11.04-amd64
Location: http://localhost:9292/v1/images/4
Etag: b6149317c554d2c335365e7bd43e9bf0
Date: Sun, 14 Aug 2011 17:57:48 GMT
</code></pre>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Giving Octopress a Try]]></title>
    <link href="http://dewey.ws/blog/2011/08/13/giving-octopress-a-try/"/>
    <updated>2011-08-13T12:45:00-07:00</updated>
    <id>http://dewey.ws/blog/2011/08/13/giving-octopress-a-try</id>
    <content type="html"><![CDATA[<p><a href="http://octopress.org/">Octopress</a> is quite impressive.</p>
]]></content>
  </entry>
  
</feed>

