Skip to content

Instantly share code, notes, and snippets.

@dansteen
Last active August 29, 2015 14:24
Show Gist options
  • Save dansteen/5ed3195e4762feeee6b8 to your computer and use it in GitHub Desktop.
Save dansteen/5ed3195e4762feeee6b8 to your computer and use it in GitHub Desktop.
error output
NoMethodError
-------------
undefined method `[]' for nil:NilClass
Cookbook Trace:
---------------
/tmp/kitchen/cache/cookbooks/bob/recipes/dns.rb:52:in `block in from_file'
/tmp/kitchen/cache/cookbooks/bob/recipes/dns.rb:49:in `from_file'
/tmp/kitchen/cache/cookbooks/bob/recipes/default.rb:34:in `from_file'
Relevant File Content:
----------------------
/tmp/kitchen/cache/cookbooks/bob/recipes/dns.rb:
45: # grab the location of aws
46: aws = shell_out("/usr/bin/which aws").stdout.strip
47:
48: # tag our box in aws to match the dns name
49: execute "tag_instance" do
50: command lazy { "#{aws} ec2 create-tags --tags Key=Name,Value=#{record.gsub('.bob.com', '')} --resources #{node['ec2']['instance_id']} --region=us-east-1" }
51: only_if { node['ec2'] and node['ec2']['instance_id'] }
52>> not_if "#{aws} ec2 describe-tags --region=us-east-1 --filters Name=resource-id,Values=#{node['ec2']['instance_id']} Name=key,Values=Name --output text|grep #{record.gsub('.bob.com', '')}"
53: end
54:
55:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment