Avoiding a series of tests with Ruby Hashes of Hashes that might have nil before the leaf hash

I’m mostly using Ruby to write Opscode Chef Cookbooks. There are a lot of hashes of hashes that contain attributes or Data Bags. Things that look like:

app['rds_database'][environment]['rds_name']

If I wanted to test if this value is set I couldn’t safely just say:

if app['rds_database'][environment]['rds_name']

because in some cases

if app['rds_database']

or

if app['rds_database'][environment] [...]

Deploy WordPress to Amazon EC2 Micro Instance with Opscode Chef

Updates September 9, 2011

Included the latest Chef Knife ec2 server create argument that sets the EBS Volume to not be deleted on the termination of the EC2 Instance

Intro

Up until recently a friend lent me a Virtual Machine in he Cloud for my Blog. I didn’t have to do anything to manage [...]

Nice jruby installation cookbook (Opscode)

There are a lot of good example Opscode cookbooks out there. Unfortunately they can be hard to find. People are not submitting them to the Opscode Cookbook repository. Its still hard to untangle your own cookbooks into something that can be put in a sharable format I guess.

Right now, the most productive way [...]

Using the Official Opscode 0.8.x Gems to build EC2 AMI Chef Client and Server

Updates Mar 3, 2010 Added call to script ec2-set-defaults that is normally called on ec2 init that sets the locale and apt sources for EC availability Zone Introduction

Opscode has officially released 0.8.x of Chef. It is now even more fabulous. I’ve been using the pre-release version for the last couple of months and [...]