- From: Daniel Condomitti <
>
- To:
- Subject: [chef] Re: Re: Re: Re: AWS cookbook and the run list
- Date: Fri, 23 Jan 2015 19:29:47 -0500
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 <
">
> 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
Archive powered by MHonArc 2.6.16.