opscode/knife-ec2 — pull request #89 by marcantonio (2012-10-23 18:14:30+00:00)
Title: knife always thinks it's running in ec2 when knife-ec2 is installed

Every time knife runs and knife-ec2 is installed it sets an empty hint for ec2. This has the side effect of creating an empty ec2.json file in /etc/chef/ohai when using any of the knife/bootstrap/*.erb templates.

Among other potential problems, this causes `looks_like_ec2?` to always return true:

/usr/lib/ruby/gems/1.9.1/gems/ohai-6.14.0/lib/ohai/plugins/ec2.rb:
```
def looks_like_ec2?
# Try non-blocking connect so we don't "block" if
# the Xen environment is *not* EC2
hint?('ec2') || has_ec2_mac? && can_metadata_connect?(EC2_METADATA_ADDR,80)
end
```

The end result being that Chef _always_ blocks (for several minutes) on an EC2 metadata request regardless of the platform used.

My fix initializes the `:hints` hash if it's nil (which I would guess was the original intent) but leaves it empty.