Skip to content

Moonshine.yml files not being loaded or configuration object appears empty

technicalpickles edited this page Feb 21, 2013 · 1 revision

After a day of updating your development environment to the latest everything, it's possible you may find that while deploys used to work, they fail now in weird places in the manifest, in ways that makes you think something is nil:

  * executing "sudo -p 'sudo password: ' RAILS_ROOT=/srv/app/releases/20130221030057 DEPLOY_STAGE=staging RAILS_ENV=staging shadow_puppet  /srv/app/releases/20130221030057/app/manifests/application_manifest.rb"
    servers: ["staging"]
    [staging] executing command
 ** [out :: staging] Uncaught exception: NoMethodError: undefined method `[]' for nil:NilClass
 ** [out :: staging] /srv/app/releases/20130221030057/app/manifests/application_manifest.rb:50
 ** [out :: staging] /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
 ** [out :: staging] /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
 ** [out :: staging] /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:182:in `require'
 ** [out :: staging] /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:547:in `new_constants_in'
 ** [out :: staging] /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:182:in `require'
 ** [out :: staging] /usr/lib/ruby/gems/1.8/gems/shadow_puppet-0.6.2/bin/shadow_puppet:130
 ** [out :: staging] /usr/bin/shadow_puppet:19:in `load'
 ** [out :: staging] /usr/bin/shadow_puppet:19

If you peek at the line in the manifest at line 50, you may be surprised to see a line line:

configuration[:foo][:bar]

So either configuration or configuration[:foo] is nil, but why would it be all of a sudden?

To start to understand check two things:

  • gem --version capistrano
  • :shared_children in config/moonshine.yml

If you are reading this still, it's likely have you capistrano > 2.12 and you have config listed in :shared_children. If that's the case, there's two possible fixes:

  • downgrade capistrano (but other developers would run into it)
  • remove config from :shared_children, and add tmp in it's place

The gist of what's happening is that the behavior of shared_children in capistrano changed along the versions after 2.12, such that they are removed from the new release directory. As you might guess, removing config is considered harmful so should be avoid. Read details in this capistrano issue

Clone this wiki locally