elasticsearch/cookbook-elasticsearch — pull request #173 by thorrsson (2013-12-20 05:04:43+00:00)
Title: Updates to the EBS provider, use existing node data in place of attributes

Updates to the EBS provider, use existing node data in place of attributes and curls, also some comments and tidying. These changes will help prevent errors due to incorrectly set attributes and ensures the volume is created in the correct AZ as well as speeds up the convergence by removing the call to the metadata api

TODO - Wrap the aws variable assignment and rescue it .. the variable is assigned the failed connection results if there is a problem, which causes the rest of the process to fail (comments for troubleshooting inline)

I made these changes based on the following testing in the chef-shell:

$ chef-shell -z
chef > node.ec2.placement_availability_zone
=> "us-east-1a"
chef > instance_id = node[:ec2][:instance_id]
=> "i-XXXXXXXX"
chef > region = node[:ec2][:placement_availability_zone].chop()
=> "us-east-1"
chef > fog_options = { :provider => 'AWS', :region => region, :use_iam_profile => true }
=> {:provider=>"AWS", :region=>"us-east-1", :use_iam_profile=>true}
chef > aws = Fog::Compute.new(fog_options)
=> Blah
chef > aws.servers.get(instance_id)
=>