aws / opsworks-cookbooks

Chef Cookbooks for the AWS OpsWorks Service
Other
1.06k stars 1.23k forks source link

Error executing action `create` on resource memcached.yml #351

Open laertispappas opened 8 years ago

laertispappas commented 8 years ago

Error executing action create on resource 'template[/srv/www/test-app-app/shared/config/memcached.yml]'

NoMethodError

undefined method `[]' for nil:NilClass

Cookbook Trace:

/var/lib/aws/opsworks/cache.stage2/cookbooks/rails/recipes/configure.rb:51:in `block (3 levels) in from_file'

Resource Declaration:

In /var/lib/aws/opsworks/cache.stage2/cookbooks/rails/recipes/configure.rb

37: template "#{deploy[:deploy_to]}/shared/config/memcached.yml" do 38: source "memcached.yml.erb" 39: cookbook 'rails' 40: mode "0660" 41: group deploy[:group] 42: owner deploy[:user] 43: variables( 44: :memcached => deploy[:memcached] || {}, 45: :environment => deploy[:rails_env] 46: ) 47: 48: notifies :run, "execute[restart Rails app #{application}]" 49: 50: only_if do 51: deploy[:memcached][:host].present? && File.directory?("#{deploy[:deploy_to]}/shared/config/") 52: end 53: end 54: end

laertispappas commented 8 years ago

Solved by adding a custom JSON to stack for memcahce attribute: { "deploy": { "allpolls-app": { "database": { "adapter": "postgresql", "encoding": "unicode", "host": "....rds.amazonaws.com", "port": "1234", "database": "test_production", "pool": "5", "username": "...", "password": "..." }, "redis": { "host": "....amazonaws.com", "port": "..." }, "memcached": { } } } }

sethfloydjr commented 7 years ago

Im seeing the same issue but adding the custom json as above has not worked for me.