Ah yes. I missed the first part of Greg's email that stated that his
run_list contains recipe[aws::ec2_hints]. So... maybe not a good thing
to do when running under Vagrant 
On Fri, Jan 23, 2015 at 7:29 PM, Daniel Condomitti
daniel@condomitti.com wrote:
Julian,
That’s the expected behavior, right? aws::ec2_hints adds the ec2 hints file
for ohai which causes the node to be recognized as EC2 even if it isn’t. It
doesn’t have any normal attributes populated but the node[‘ec2’] key exists.
This is a CentOS 6.5 node running in VirtualBox
chef-shell -z
...
chef > File.exists?('/etc/chef/ohai/hints/ec2.json')
=> false
chef > node['ec2']
=> nil
chef > exit
mkdir -p /etc/chef/ohai/hints
touch ohai/hints/ec2.json
chef-shell -z
....
chef > File.exists?('/etc/chef/ohai/hints/ec2.json')
=> true
chef > node['ec2']
=> #<Chef::Node::Attribute @normal={...}, @current_normal=nil,
@default={...}, @current_default=nil, @override={...},
@current_override=nil, @automatic={...}, @current_automatic={},
@current_nesting_level=["ec2"], @auto_vivifiy_on_read=false,
@set_unless_value_present=false, @set_type=nil, @has_been_read=false>
On Friday, January 23, 2015 at 7:11 PM, Julian C. Dunn wrote:
On Wed, Jan 21, 2015 at 10:07 PM, Greg Barker fletch@fletchowns.net wrote:
So I added this to my metadata.rb:
depends 'aws'
Added this to my run_list:
"recipe[aws]",
"recipe[aws::ec2_hints]",
Added this to my recipe:
if node["ec2"]
include_recipe "mycookbook::ec2_specific_thing"
end
Works great when I ran it on an EC2 instance. But when I tried a vagrant up
for a local VM, it hits an error in my ec2_specific_thing recipe. I
thought it wasn't going to be executed at all though. Any ideas?
That shouldn't happen. Can you paste the error?
--
[ Julian C. Dunn jdunn@aquezada.com * Sorry, I'm ]
[ WWW: Julian Dunn's Blog - Commentary on media, technology, and everything in between. * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]