Skip to content

Instantly share code, notes, and snippets.

@Aslan
Created February 5, 2010 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Aslan/296279 to your computer and use it in GitHub Desktop.
Save Aslan/296279 to your computer and use it in GitHub Desktop.
# complain if no snapshot id provided
#
snapshot_id = node[:channels][:database][:snapshot_id] rescue nil
raise "No snapshot id specified." if snapshot_id.blank?
device = node[:channels][:database][:device] rescue nil
raise "No device specified for the database volume" if device.blank?
# mount ebs volume
#
include_recipe "aws"
aws_ebs_volume "database_volume" do
provider "aws_ebs_volume"
action :create
snapshot_id snapshot_id
device device
aws_access_key node[:channels][:aws][:access_key]
aws_secret_access_key node[:channels][:aws][:secret_access_key]
end
aws_ebs_volume "attach_database_volume" do
provider "aws_ebs_volume"
action :attach
volume_id "#{node[:aws][:ebs_volume][:database_volume][:volume_id]}"
device device
aws_access_key node[:channels][:aws][:access_key]
aws_secret_access_key node[:channels][:aws][:secret_access_key]
end
[Fri, 05 Feb 2010 14:57:48 -0500] INFO: Starting Chef Solo Run
/mnt/chef/channels-reader-is/chef/chef-repo/cookbooks/channels/recipes/database.rb:25:in `from_file': undefined method `[]' for nil:NilClass (NoMethodError)
from /usr/lib/ruby/gems/1.8/gems/chef-0.7.16/lib/chef/mixin/recipe_definition_dsl_core.rb:68:in `instance_eval'
from /usr/lib/ruby/gems/1.8/gems/chef-0.7.16/lib/chef/mixin/recipe_definition_dsl_core.rb:68:in `method_missing'
from /mnt/chef/channels-reader-is/chef/chef-repo/cookbooks/channels/recipes/database.rb:22:in `from_file'
from /usr/lib/ruby/gems/1.8/gems/chef-0.7.16/lib/chef/cookbook.rb:166:in `load_recipe'
from /usr/lib/ruby/gems/1.8/gems/chef-0.7.16/lib/chef/compile.rb:153:in `load_recipes'
from /usr/lib/ruby/gems/1.8/gems/chef-0.7.16/lib/chef/compile.rb:142:in `each'
from /usr/lib/ruby/gems/1.8/gems/chef-0.7.16/lib/chef/compile.rb:142:in `load_recipes'
from /usr/lib/ruby/gems/1.8/gems/chef-0.7.16/lib/chef/compile.rb:50:in `initialize'
... 6 levels...
from /usr/lib/ruby/gems/1.8/gems/chef-0.7.16/lib/chef/application.rb:57:in `run'
from /usr/lib/ruby/gems/1.8/gems/chef-0.7.16/bin/chef-solo:26
from /usr/bin/chef-solo:19:in `load'
from /usr/bin/chef-solo:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment