Automate All the Things!

Doug Ireton's blog about Chef, Git, Ruby, Vim, and Infrastructure Automation

Encouraging Women in Dev/Ops

| Comments

This past week, I went to Velocity and DevOps Days in Silicon Valley, CA. Both conferences were amazing and I learned a ton. During DevOps Days I led an Open Space session on “Encouraging Women in Dev/Ops”. I was humbled by the number of people who attended and their passion for the topic. Read on for a summary of my notes taken during the hour we had.

Ruby Fundamentals: Using Custom Setters to Clean Up Instance Variables

| Comments

Ohai Fellow Rubyists!

This week we’re going to look at using custom setter methods in your Ruby class initializers to do any custom logic before setting instance variables. I just had to do this last week for a gem I’m writing. Here’s a quick snippet. Read on for the full explanation.

class StashNotifier
  attr_reader :job_status


  def initialize(args)
    # other instance vars omitted
    self.job_status  = args[:job_status] # <= call the custom setter
    @job_key         = args[:job_key]
    @job_url         = args[:job_url]

  # custom setter method
  def job_status=(new_job_status)
    new_job_status = new_job_status.strip.upcase

    if VALID_JOB_STATUSES.include?(new_job_status)
      @job_status = new_job_status
      raise ArgumentError, "'#{new_job_status}' is not a valid Stash Build
Status! Valid job statuses are #{VALID_JOB_STATUSES}."
# rest of class omitted

Will You Join Us?

| Comments

Ohai Chefs!

This week, the week before Chef Conf, I’d like to talk a bit about our team and our culture, and invite you to join us.


We have a spot on our Infrastructure Engineering team, and I hope you’ll read on to get a personal feel for our team and the huge cultural shift happening right now at Nordstrom.

If you are interested, please email me: doug.ireton at

Favorites From the Treasure Chest

| Comments

Ohai Chefs!

Work has been busy and I’ve been working on my Chef Conf presentation in my “free” time, so this week I’m rounding up some links I think you’ll like.

  1. Last check-in time for nodes by Josh Timberman. Nice short post with great explanations.

  2. How the Chef client builds the Resource Collection queue by Eric Hollensbe. I have a much better understanding of how a Chef run actually works after reading this.

  3. Good overview of Chef testing by Nathen Harvey.

  4. Also see Joshua Timberman’s Anatomy of a Test Kitchen 1.0 Cookbook for more testing goodness.

Chef Wanted. Apply Within

| Comments

Ohai Chefs!

This week, we’ll take a look at chef-apply, a command-line tool, new to Chef 11, which assists with rapid development and troubleshooting by letting you run a single recipe at a time.

Ruby -p -i -e

| Comments

This week we’ll look at a practical example of combining a simple shell script with a Ruby one-liner to set and unset environment variables.

The Tragic Backstory

At work, we have to go through a proxy server to get to the Internet. To use git, curl, etc. I have to set my http(s)_proxy environment varables. At home I have to unset them since I don’t have a proxy at home. Editing my .zshenv twice a day got pretty tedious so I decided to script it.

At first I tried using sed but after trying for an hour to understand how to write a simple sed script, I opted for Ruby. As it turns out, Ruby has very good support for line-editing and substitution.

A knife.rb for Our Time

| Comments

Ohai Chefs!

The basic knife.rb you get from the Chef server works, but it’s not suitable to check into version control or share with your team. It has the name of your .pem file hardcoded into it and isn’t flexible enough for team use. This week we’ll look at a generic, flexible knife.rb you can keep in your chef-repo and share with your team.

Flip Your Unicorn!

| Comments

Let’s say you had a unicorn in your code. Maybe something like this:

     \                               ,##@&::%&&%%::&@##.
     ^\^                            #@&:%%000000000%%:&@#
     /.(((                        #@&:%00'         '00%:&@#
    (,/"(((__,--.                #@&:%0'             '0%:&@#
        \  ) _( /{              #@&:%0                 0%:&@#
        !|| " :||              #@&:%0                   0%:&@#
        !||   :||              #@&:%0                   0%:&@#
        '''   '''              "" ' "                   " ' ""

But it’s so wrong!

Clearly, something is wrong with the unicorn. It’s not facing the rainbow. This week, we’ll learn how to flip the unicorn (or any other text) with an awesome Vim Visual mode mapping courtesy of the inimitable Dr. Chip

Send Application Deploy Times to StatsD in a Chef Recipe

| Comments

Ohai Chefs!

This week, I’ll show you how to time application deploys (or anything else) inside a Chef recipe and send metrics to StatsD.

At work, we’re working to integrate metrics into more and more aspects of our development pipeline. We are already sending Chef run data to Graphite and Chef client version metrics to StatsD/Graphite. This past week, I worked on timing our application deploys via the Statsd-Ruby library inside a Chef recipe. Read on to see how easy it is.