Skip to main content

Benjamin Oakes

Photo of Ben Oakes

Hi, I'm Ben Oakes and this is my geek blog. Currently, I'm a Ruby/JavaScript Developer at Liaison. Previously, I was a Developer at Continuity and Hedgeye, a Research Assistant in the Early Social Cognition Lab at Yale University and a student at the University of Iowa. I also organize, ICRuby, OpenHack Iowa City, and previously organized NewHaven.rb. I have an amazing wife named Danielle Oakes.

Filtering for the month April, 2013. Clear

Weekly roundup

by Ben

Like last week, these are some interesting posts I found around the web, along with some commentary from me.

Making Puppet’s fqdn_rand play nice with Vagrant

by Ben

We’ve been using Vagrant more and more, especially for testing our Puppet code. It can be much more flexible than testing on an existing box, and Vagrant AWS is really promising.

But when we first started using Puppet with Vagrant, Puppet was freaking out.

Freaked out puppets

We resolved most of the errors quickly, but we couldn’t figure out what to do about this error message:

can't convert String into Integer at /tmp/vagrant-puppet/modules-0/puppet/manifests/init.pp:11 on node localhost.localdomain

Immediately, we tracked it down to a use of the fqdn_rand function.

minute => fqdn_rand(60),

The easy fix was to cheat and just put in a number by hand.

minute => 42, # fqdn_rand(60),

That got us by, but it felt dirty. We knew the problem was only happening when we tried to use Puppet in conjunction with Vagrant. Since FQDN stands for Fully Qualified Domain Name, it seemed like Puppet needed more information, but the documentation wasn’t too helpful on how to provide that.

I had found out how to set the hostname to provision Vagrant boxes as different nodes, so that was my first attempt.

config.vm.hostname = ''

Alas, that didn’t fix the issue. What other options were there? Use another function for random numbers?

The trouble is, the only random number function we could find for the Puppet language was fqdn_rand. There wasn’t anything else, and that’s really weird. Something like mac_rand (using the MAC address) would make sense, but all we could find was abandoned tickets in the Puppet Redmine, if anything. (That’s becoming a theme in our experience, actually…)

We went back to doing the dirty solution, and just avoided committing that file. That went on for at least a week.

I got fed up with it again today, and searched some more. It turns out that you can set the FQDN using puppet.facter, and there was a bug with this before Puppet 3. We are currently using 3.1.1.

This is what we had to do to get Puppet to stop complaining. Note that this didn’t work for us without both the hostname and the fqdn values set.

Update (2013-04-26): It seems like FQDN doesn’t play as big of a role as I first thought — the problem seems to go away with just hostname set when using Puppet 3.1.1.

# File: Vagrantfile
Vagrant.configure('2') do |config|      = '[...]'
  config.vm.hostname = ''

  # [...]

  config.vm.provision :puppet, :module_path => %w(modules) do |puppet|
    # fix `fqdn_rand` error
    puppet.facter = { 'fqdn' => config.vm.hostname }

And now our Puppet is happy again.

Happy puppet

(Keep in mind that Vagrantfile settings like these might require a vagrant reload or a vagrant destroy --force && vagrant up.)

Puppet is a little hard to understand sometimes, and this solved a long standing issue for us. It’s worth noting that this could also be used for testing virtual hosts, as mentioned in the vagrant-puppet README.


Weekly roundup

by Ben

These are some interesting posts I found around the web this week, along with some commentary from me. You can check out last week’s roundup too. :)

Creative Corridor Launch

by Ben

I had a great time today at the Creative Corridor Launch. I was really impressed by the number of people there (approx 300), and the event itself. I’m really for the idea of presenting this region in a better light. Like many Iowans, I’ve heard plenty of corn jokes, etc. when traveling and living elsewhere. There are too many amazing people living here for that to be the only impression Iowa leaves. Let’s fix that!

My favorite quote from the event: “not only do we create here, we are also creating here“.
The Creative Corridor is what we make of it, after all, so let’s make the most of it.

We Create Here - Iowa's Creative Corridor

Below is a video they presented at the event, which I think turned out very well. Here’s hoping it helps de-mystify Iowa to those living outside the Midwest!

Sunday 4/21: OpenHack + OpenHardware

by Ben

Just a friendly reminder that it’s almost the 3rd Sunday of the month, so we’ll be getting together for OpenHack over at Busy Coworking.

The event is open to the public. RSVP on Meetup.

Weekly roundup

by Ben

I thought I’d try something new and share some links I collected while reading this week, along with some commentary on why they were interesting to me. I hope you find some of them worth a read!

SSH Agent Forwarding with Vagrant AWS

by Ben

The in-progress Vagrant AWS has a lot of promise, especially for devops. The ability to test your Puppet or Chef scripts on an EC2 instance using Vagrant is very tempting. Unfortunately, it’s not yet quite stable enough to rely on, in my experience. Some errors seem to happen sporadically. Most are related to ssh, although running ssh manually works fine (either vagrant ssh or ssh user@host).

Sometimes, something as simple as mkdir fails without reason:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p '/vagrant'

Other times, rsync completes, but then it immediately terminates the instance:

[default] Rsyncing folder: /home/ben/aws-sandbox/ => /vagrant
[default] Terminating the instance...

I’m still hopeful that it can be useful to us in the future. Like I said, there’s a lot of promise in this young project.

At any rate, we took some time to research how to get SSH agent forwarding working, which is valuable for us when remote pairing. We were getting stuck with errors like this:

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

It turns out that vagrant itself ignores anything but identity files, which was key to getting agent forwarding to work. This can be inspected using vagrant ssh-config

It turns out that lib/vagrant/util/ssh.rb can be modified like so:

--- a/lib/vagrant/util/ssh.rb
+++ b/lib/vagrant/util/ssh.rb
@@ -108,7 +108,7 @@ module Vagrant
         # IdentitiesOnly option. Also, we don't enable it in plain mode so
         # that SSH properly searches our identities and tries to do it itself.
         if !Platform.solaris? && !plain_mode
-          command_options += ["-o", "IdentitiesOnly=yes"]
+          command_options += ["-o", "IdentitiesOnly=no"]
         # If we're not in plain mode, attach the private key path.

There’s a related change that can be made to make vagrant ssh-config match, but it seems to be cosmetic:

--- a/templates/commands/ssh_config/config.erb
+++ b/templates/commands/ssh_config/config.erb
@@ -6,7 +6,7 @@ Host <%= host_key %>
   StrictHostKeyChecking no
   PasswordAuthentication no
   IdentityFile "<%= private_key_path %>"
-  IdentitiesOnly yes
+  IdentitiesOnly no
   LogLevel FATAL
 <% if forward_agent -%>
   ForwardAgent yes

That was enough to get our SSH agent forwarding to work. These changes make sense in the context of AWS, but probably not in Vagrant at large. I’m tempted to make a pull request, but the above changes are a little half baked — and vagrant-aws still needs some fine tuning before the change can really be tested.

Popops Enabled

by Ben


Seen at TriNet (HR Passport site).

Stormcloud for Chrome

by Ben


My review of Stormcloud for Chrome:

4 out of 5 stars. Beautiful so far. Been wanting a trial in the Ubuntu Software Center as well, but I’ll take the Chrome version. :)

The preferences look nice but are hard to use. I wouldn’t have found out that I had to click the “check” next to my newly-added city to get it to stick if I hadn’t read it on a blog post. That needs a fix ASAP, as I’m not the only one running into it!

Pretty crazy to think about, isn’t it?

by Ben

Photographer/Astronaut: Michel Collins

Reblogged from imgur