Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passenger version & dry-run: undefined method `[]' for nil:NilClass #20

Closed
Sevyls opened this issue May 19, 2015 · 8 comments
Closed

passenger version & dry-run: undefined method `[]' for nil:NilClass #20

Sevyls opened this issue May 19, 2015 · 8 comments

Comments

@Sevyls
Copy link

Sevyls commented May 19, 2015

I was running a dry-run with the following configuration and got an unexpected exception while running deploy:

/home/michael/.rvm/gems/ruby-1.9.3-p551/bin/cap development deploy --dry-run --trace

Capfile

require 'capistrano/setup'
require 'capistrano/deploy'

require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano/passenger'

config/deploy.rb

lock '3.4.0'

set :application, 'project'

set :repo_url, '[email protected]:organization/project.git'

set :deploy_to, '/var/www/project'

config/deploy/development.rb

server 'host', user: 'user', roles: %w{app db web}

set :deploy_to, '/var/www/dev.project'

Log

  INFO [188d35fb] Running /usr/bin/env which passenger as user@host
** Invoke development (first_time)
 DEBUG [188d35fb] Command: /usr/bin/env which passenger
** Execute development
  INFO [2af5a0f7] Running /usr/bin/env [ -d ~/.rvm ] as user@host
** Invoke load:defaults (first_time)
 DEBUG [2af5a0f7] Command: [ -d ~/.rvm ]
** Execute load:defaults
  INFO [23fe168e] Running ~/.rvm/bin/rvm version as user@host
** Invoke rvm:hook (first_time)
 DEBUG [23fe168e] Command: ~/.rvm/bin/rvm version
** Invoke passenger:rvm:hook (first_time)

** Execute passenger:rvm:hook
  INFO [6044c812] Running ~/.rvm/bin/rvm current as user@host
** Execute rvm:hook
 DEBUG [6044c812] Command: ~/.rvm/bin/rvm current
** Invoke rvm:check (first_time)

** Execute rvm:check
  INFO [7c274162] Running ~/.rvm/bin/rvm default do ruby --version as user@host
** Invoke bundler:map_bins (first_time)
 DEBUG [7c274162] Command: ~/.rvm/bin/rvm default do ruby --version
** Execute bundler:map_bins

** Invoke deploy:set_rails_env (first_time)
  INFO [3ac326a7] Running /usr/bin/env mkdir -p /tmp/project/ as user@host
** Execute deploy:set_rails_env
 DEBUG [3ac326a7] Command: /usr/bin/env mkdir -p /tmp/project/
** Invoke deploy:set_rails_env 
** Invoke deploy (first_time)
  INFO [35443c3b] Running /usr/bin/env #<StringIO:0x000000017cd2f0> /tmp/project/git-ssh.sh as user@host
** Execute deploy
 DEBUG [35443c3b] Command: /usr/bin/env #<StringIO:0x000000017cd2f0> /tmp/project/git-ssh.sh
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
** Execute deploy:check
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
  INFO [cddac1d3] Running /usr/bin/env chmod +x /tmp/project/git-ssh.sh as user@host
 DEBUG [cddac1d3] Command: /usr/bin/env chmod +x /tmp/project/git-ssh.sh
** Execute git:check
  INFO [bd35090c] Running /usr/bin/env git ls-remote --heads [email protected]:organization/project.git as user@host
 DEBUG [bd35090c] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/project/git-ssh.sh /usr/bin/env git ls-remote --heads [email protected]:organization/project.git )
  INFO [1c674eb0] Running /usr/bin/env mkdir -p /var/www/dev.project/shared /var/www/dev.project/releases as user@host
 DEBUG [1c674eb0] Command: /usr/bin/env mkdir -p /var/www/dev.project/shared /var/www/dev.project/releases
  INFO [60e6e662] Running /usr/bin/env mkdir -p /var/www/dev.project/shared/public/assets as user@host
 DEBUG [60e6e662] Command: /usr/bin/env mkdir -p /var/www/dev.project/shared/public/assets
  INFO [9be3788b] Running /usr/bin/env [ -f /var/www/dev.project/current/REVISION ] as user@host
 DEBUG [9be3788b] Command: [ -f /var/www/dev.project/current/REVISION ]
  INFO [ba40c474] Running /usr/bin/env cat /var/www/dev.project/current/REVISION 2>/dev/null as user@host
 DEBUG [ba40c474] Command: /usr/bin/env cat /var/www/dev.project/current/REVISION 2>/dev/null
  INFO [57a186f0] Running /usr/bin/env [ -f /var/www/dev.project/repo/HEAD ] as user@host
 DEBUG [57a186f0] Command: [ -f /var/www/dev.project/repo/HEAD ]
  INFO The repository mirror is at /var/www/dev.project/repo
 DEBUG [2c073709] Running /usr/bin/env if test ! -d /var/www/dev.project/repo; then echo "Directory does not exist '/var/www/dev.project/repo'" 1>&2; false; fi as user@host
 DEBUG [2c073709] Command: if test ! -d /var/www/dev.project/repo; then echo "Directory does not exist '/var/www/dev.project/repo'" 1>&2; false; fi
  INFO [1e05b25a] Running /usr/bin/env git remote update as user@host
 DEBUG [1e05b25a] Command: cd /var/www/dev.project/repo && ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/project/git-ssh.sh /usr/bin/env git remote update )
 DEBUG [a36ced43] Running /usr/bin/env if test ! -d /var/www/dev.project/repo; then echo "Directory does not exist '/var/www/dev.project/repo'" 1>&2; false; fi as user@host
 DEBUG [a36ced43] Command: if test ! -d /var/www/dev.project/repo; then echo "Directory does not exist '/var/www/dev.project/repo'" 1>&2; false; fi
  INFO [b2b5fe61] Running /usr/bin/env mkdir -p /var/www/dev.project/releases/20150519092353 as user@host
 DEBUG [b2b5fe61] Command: cd /var/www/dev.project/repo && ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/project/git-ssh.sh /usr/bin/env mkdir -p /var/www/dev.project/releases/20150519092353 )
  INFO [8439eb54] Running /usr/bin/env git archive master | tar -x -f - -C /var/www/dev.project/releases/20150519092353 as user@host
 DEBUG [8439eb54] Command: cd /var/www/dev.project/repo && ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/project/git-ssh.sh /usr/bin/env git archive master | tar -x -f - -C /var/www/dev.project/releases/20150519092353 )
** Invoke deploy:check:directories (first_time)
** Execute deploy:check:directories
** Invoke deploy:check:linked_dirs (first_time)
** Execute deploy:check:linked_dirs
** Invoke deploy:check:make_linked_dirs (first_time)
** Execute deploy:check:make_linked_dirs
** Invoke deploy:check:linked_files (first_time)
** Execute deploy:check:linked_files
** Invoke deploy:set_previous_revision (first_time)
** Execute deploy:set_previous_revision
** Invoke deploy:started (first_time)
** Execute deploy:started
** Invoke deploy:updating (first_time)
** Invoke deploy:new_release_path (first_time)
** Execute deploy:new_release_path
** Execute deploy:updating
** Invoke git:create_release (first_time)
** Invoke git:update (first_time)
** Invoke git:clone (first_time)
** Invoke git:wrapper 
** Execute git:clone
** Execute git:update
** Execute git:create_release
** Invoke deploy:set_current_revision (first_time)
** Execute deploy:set_current_revision
** Invoke git:set_current_revision (first_time)
** Execute git:set_current_revision
 DEBUG [604f2f3e] Running /usr/bin/env if test ! -d /var/www/dev.project/repo; then echo "Directory does not exist '/var/www/dev.project/repo'" 1>&2; false; fi as user@host
 DEBUG [604f2f3e] Command: if test ! -d /var/www/dev.project/repo; then echo "Directory does not exist '/var/www/dev.project/repo'" 1>&2; false; fi
  INFO [f2b9cb5b] Running /usr/bin/env git rev-list --max-count=1 --abbrev-commit master as user@host
 DEBUG [f2b9cb5b] Command: cd /var/www/dev.project/repo && ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/project/git-ssh.sh /usr/bin/env git rev-list --max-count=1 --abbrev-commit master )
 DEBUG [4ccfba9d] Running /usr/bin/env if test ! -d /var/www/dev.project/releases/20150519092353; then echo "Directory does not exist '/var/www/dev.project/releases/20150519092353'" 1>&2; false; fi as user@host
 DEBUG [4ccfba9d] Command: if test ! -d /var/www/dev.project/releases/20150519092353; then echo "Directory does not exist '/var/www/dev.project/releases/20150519092353'" 1>&2; false; fi
  INFO [2759a50e] Running /usr/bin/env echo "" >> REVISION as user@host
 DEBUG [2759a50e] Command: cd /var/www/dev.project/releases/20150519092353 && /usr/bin/env echo "" >> REVISION
** Invoke deploy:symlink:shared (first_time)
** Execute deploy:symlink:shared
** Invoke deploy:symlink:linked_files (first_time)
** Execute deploy:symlink:linked_files
** Invoke deploy:symlink:linked_dirs (first_time)
** Execute deploy:symlink:linked_dirs
  INFO [f1a9d27e] Running /usr/bin/env mkdir -p /var/www/dev.project/releases/20150519092353/public as user@host
 DEBUG [f1a9d27e] Command: /usr/bin/env mkdir -p /var/www/dev.project/releases/20150519092353/public
  INFO [401eabce] Running /usr/bin/env [ -L /var/www/dev.project/releases/20150519092353/public/assets ] as user@host
 DEBUG [401eabce] Command: [ -L /var/www/dev.project/releases/20150519092353/public/assets ]
 DEBUG [6fa0d28d] Running /usr/bin/env if test ! -d /var/www/dev.project/releases/20150519092353; then echo "Directory does not exist '/var/www/dev.project/releases/20150519092353'" 1>&2; false; fi as user@host
 DEBUG [6fa0d28d] Command: if test ! -d /var/www/dev.project/releases/20150519092353; then echo "Directory does not exist '/var/www/dev.project/releases/20150519092353'" 1>&2; false; fi
  INFO [c2fb92dc] Running ~/.rvm/bin/rvm default do bundle install --path /var/www/dev.project/shared/bundle --without development test --deployment --quiet as user@host
 DEBUG [c2fb92dc] Command: cd /var/www/dev.project/releases/20150519092353 && ~/.rvm/bin/rvm default do bundle install --path /var/www/dev.project/shared/bundle --without development test --deployment --quiet
** Invoke deploy:updated (first_time)
** Invoke bundler:install (first_time)
** Execute bundler:install
** Execute deploy:updated
** Invoke deploy:compile_assets (first_time)
** Invoke deploy:set_rails_env 
** Execute deploy:compile_assets
** Invoke deploy:assets:precompile (first_time)
** Execute deploy:assets:precompile
 DEBUG [2ae3124e] Running /usr/bin/env if test ! -d /var/www/dev.project/releases/20150519092353; then echo "Directory does not exist '/var/www/dev.project/releases/20150519092353'" 1>&2; false; fi as user@host
 DEBUG [2ae3124e] Command: if test ! -d /var/www/dev.project/releases/20150519092353; then echo "Directory does not exist '/var/www/dev.project/releases/20150519092353'" 1>&2; false; fi
  INFO [8996e9a0] Running ~/.rvm/bin/rvm default do bundle exec rake assets:precompile as user@host
 DEBUG [8996e9a0] Command: cd /var/www/dev.project/releases/20150519092353 && ( RAILS_ENV=development ~/.rvm/bin/rvm default do bundle exec rake assets:precompile )
 DEBUG [b0e3cb89] Running /usr/bin/env if test ! -d /var/www/dev.project/releases/20150519092353; then echo "Directory does not exist '/var/www/dev.project/releases/20150519092353'" 1>&2; false; fi as user@host
 DEBUG [b0e3cb89] Command: if test ! -d /var/www/dev.project/releases/20150519092353; then echo "Directory does not exist '/var/www/dev.project/releases/20150519092353'" 1>&2; false; fi
  INFO [6172eb12] Running /usr/bin/env mkdir -p /var/www/dev.project/releases/20150519092353/assets_manifest_backup as user@host
 DEBUG [6172eb12] Command: cd /var/www/dev.project/releases/20150519092353 && /usr/bin/env mkdir -p /var/www/dev.project/releases/20150519092353/assets_manifest_backup
  INFO [1ff87779] Running /usr/bin/env ls /var/www/dev.project/releases/20150519092353/public/assets/.sprockets-manifest* as user@host
 DEBUG [1ff87779] Command: cd /var/www/dev.project/releases/20150519092353 && /usr/bin/env ls /var/www/dev.project/releases/20150519092353/public/assets/.sprockets-manifest*
** Invoke deploy:assets:backup_manifest (first_time)
** Execute deploy:assets:backup_manifest
  INFO [fbdf5edb] Running /usr/bin/env ls /var/www/dev.project/releases/20150519092353/public/assets/.sprockets-manifest* as user@host
 DEBUG [fbdf5edb] Command: cd /var/www/dev.project/releases/20150519092353 && /usr/bin/env ls /var/www/dev.project/releases/20150519092353/public/assets/.sprockets-manifest*
  INFO [30d49a60] Running /usr/bin/env cp  /var/www/dev.project/releases/20150519092353/assets_manifest_backup as user@host
 DEBUG [30d49a60] Command: cd /var/www/dev.project/releases/20150519092353 && /usr/bin/env cp  /var/www/dev.project/releases/20150519092353/assets_manifest_backup
  INFO [deploy:migrate] Run `rake db:migrate`
 DEBUG [24d35478] Running /usr/bin/env if test ! -d /var/www/dev.project/releases/20150519092353; then echo "Directory does not exist '/var/www/dev.project/releases/20150519092353'" 1>&2; false; fi as user@host
 DEBUG [24d35478] Command: if test ! -d /var/www/dev.project/releases/20150519092353; then echo "Directory does not exist '/var/www/dev.project/releases/20150519092353'" 1>&2; false; fi
  INFO [f4ad4959] Running ~/.rvm/bin/rvm default do bundle exec rake db:migrate as user@host
 DEBUG [f4ad4959] Command: cd /var/www/dev.project/releases/20150519092353 && ( RAILS_ENV=development ~/.rvm/bin/rvm default do bundle exec rake db:migrate )
** Invoke deploy:normalize_assets (first_time)
** Invoke deploy:set_rails_env 
** Execute deploy:normalize_assets
** Invoke deploy:migrate (first_time)
** Invoke deploy:set_rails_env 
** Execute deploy:migrate
** Invoke deploy:publishing (first_time)
** Execute deploy:publishing
** Invoke deploy:symlink:release (first_time)
** Execute deploy:symlink:release
  INFO [2c25ed5e] Running /usr/bin/env ln -s /var/www/dev.project/releases/20150519092353 /var/www/dev.project/releases/current as user@host
 DEBUG [2c25ed5e] Command: /usr/bin/env ln -s /var/www/dev.project/releases/20150519092353 /var/www/dev.project/releases/current
  INFO [4079994c] Running /usr/bin/env mv /var/www/dev.project/releases/current /var/www/dev.project as user@host
 DEBUG [4079994c] Command: /usr/bin/env mv /var/www/dev.project/releases/current /var/www/dev.project
  INFO [ef7d289d] Running /usr/bin/env passenger -v as user@host
 DEBUG [ef7d289d] Command: /usr/bin/env passenger -v
** Invoke deploy:restart (first_time)
** Execute deploy:restart
** Invoke passenger:restart (first_time)
** Execute passenger:restart

cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as user@host: undefined method `[]' for nil:NilClass
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/sshkit-1.7.1/lib/sshkit/runners/sequential.rb:24:in `rescue in run_backend'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/sshkit-1.7.1/lib/sshkit/runners/sequential.rb:21:in `run_backend'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/sshkit-1.7.1/lib/sshkit/runners/sequential.rb:16:in `execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/sshkit-1.7.1/lib/sshkit/coordinator.rb:15:in `each'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/dsl.rb:55:in `on'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-passenger-0.0.5/lib/capistrano/tasks/passenger.cap:4:in `block (2 levels) in <top (required)>'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/michael/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/dsl.rb:16:in `invoke'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-passenger-0.0.5/lib/capistrano/tasks/deploy_passenger.cap:6:in `block (2 levels) in <top (required)>'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/michael/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/dsl/task_enhancements.rb:14:in `block in after'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/michael/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/dsl.rb:16:in `invoke'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/tasks/framework.rake:65:in `block (2 levels) in <top (required)>'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/tasks/framework.rake:61:in `each'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/tasks/framework.rake:61:in `block in <top (required)>'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/michael/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/application.rb:15:in `run'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/bin/cap:3:in `<top (required)>'
/home/michael/.rvm/gems/ruby-1.9.3-p551/bin/cap:23:in `load'
/home/michael/.rvm/gems/ruby-1.9.3-p551/bin/cap:23:in `<top (required)>'
-e:1:in `load'
-e:1:in `<main>'
NoMethodError: undefined method `[]' for nil:NilClass
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-passenger-0.0.5/lib/capistrano/tasks/passenger.cap:6:in `block (4 levels) in <top (required)>'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/sshkit-1.7.1/lib/sshkit/backends/abstract.rb:85:in `with'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-passenger-0.0.5/lib/capistrano/tasks/passenger.cap:5:in `block (3 levels) in <top (required)>'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/sshkit-1.7.1/lib/sshkit/backends/printer.rb:9:in `instance_exec'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/sshkit-1.7.1/lib/sshkit/backends/printer.rb:9:in `run'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/sshkit-1.7.1/lib/sshkit/runners/sequential.rb:21:in `run_backend'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/sshkit-1.7.1/lib/sshkit/runners/sequential.rb:16:in `execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/sshkit-1.7.1/lib/sshkit/coordinator.rb:15:in `each'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/dsl.rb:55:in `on'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-passenger-0.0.5/lib/capistrano/tasks/passenger.cap:4:in `block (2 levels) in <top (required)>'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/michael/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/dsl.rb:16:in `invoke'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-passenger-0.0.5/lib/capistrano/tasks/deploy_passenger.cap:6:in `block (2 levels) in <top (required)>'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/michael/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/dsl/task_enhancements.rb:14:in `block in after'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/michael/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/dsl.rb:16:in `invoke'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/tasks/framework.rake:65:in `block (2 levels) in <top (required)>'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/tasks/framework.rake:61:in `each'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/tasks/framework.rake:61:in `block in <top (required)>'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/michael/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/lib/capistrano/application.rb:15:in `run'
/home/michael/.rvm/gems/ruby-1.9.3-p551/gems/capistrano-3.4.0/bin/cap:3:in `<top (required)>'
/home/michael/.rvm/gems/ruby-1.9.3-p551/bin/cap:23:in `load'
/home/michael/.rvm/gems/ruby-1.9.3-p551/bin/cap:23:in `<top (required)>'
-e:1:in `load'
-e:1:in `<main>'
Tasks: TOP => passenger:restart
The deploy has failed with an error: Exception while executing as user@host: undefined method `[]' for nil:NilClass
** Invoke deploy:failed (first_time)
** Execute deploy:failed

Environment on the host machine

Apache 2.4 + passenger 4.0.56

user@host:~> which passenger
/usr/local/rvm/gems/ruby-1.9.3-p551/bin/passenger
user@host:~> which ruby
/usr/local/rvm/rubies/ruby-1.9.3-p551/bin/ruby
user@host:~>passenger -v
Phusion Passenger version 4.0.56

"Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.21)
      actionpack (= 3.2.21)
      mail (~> 2.5.4)
    actionpack (3.2.21)
      activemodel (= 3.2.21)
      activesupport (= 3.2.21)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.5)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    activemodel (3.2.21)
      activesupport (= 3.2.21)
      builder (~> 3.0.0)
    activerecord (3.2.21)
      activemodel (= 3.2.21)
      activesupport (= 3.2.21)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.21)
      activemodel (= 3.2.21)
      activesupport (= 3.2.21)
    activesupport (3.2.21)
      i18n (~> 0.6, >= 0.6.4)
      multi_json (~> 1.0)
    airbrake (4.1.0)
      builder
      multi_json
    annotate (2.6.5)
      activerecord (>= 2.3.0)
      rake (>= 0.8.7)
    ansi (1.4.3)
    arel (3.0.3)
    awesome_print (1.2.0)
    builder (3.0.4)
    capistrano (3.4.0)
      i18n
      rake (>= 10.0.0)
      sshkit (~> 1.3)
    capistrano-bundler (1.1.4)
      capistrano (~> 3.1)
      sshkit (~> 1.2)
    capistrano-passenger (0.0.5)
      capistrano (~> 3.0)
    capistrano-rails (1.1.3)
      capistrano (~> 3.1)
      capistrano-bundler (~> 1.1)
    capistrano-rvm (0.1.2)
      capistrano (~> 3.0)
      sshkit (~> 1.2)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.3.0)
      coffee-script-source
      execjs
    coffee-script-source (1.8.0)
    colorize (0.7.7)
    daemons (1.1.9)
    dbd-pg (0.3.9)
      dbi (>= 0.4.0)
      pg
    dbi (0.4.5)
      deprecated (= 2.0.1)
    delayed_job (4.0.4)
      activesupport (>= 3.0, < 4.2)
    delayed_job_active_record (4.0.2)
      activerecord (>= 3.0, < 4.2)
      delayed_job (>= 3.0, < 4.1)
    deprecated (2.0.1)
    erubis (2.7.0)
    execjs (2.2.2)
    hashie (3.3.1)
    hike (1.2.3)
    i18n (0.7.0)
    journey (1.0.4)
    jquery-rails (3.1.2)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    jquery-ui-rails (5.0.2)
      railties (>= 3.2.16)
    json (1.8.2)
    libv8 (3.16.14.7)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.25.1)
    minitest (4.7.5)
    minitest-reporters (0.14.24)
      ansi
      builder
      minitest (>= 2.12, < 5.0)
      powerbar
    multi_json (1.10.1)
    net-scp (1.2.1)
      net-ssh (>= 2.6.5)
    net-ssh (2.9.2)
    netrc (0.8.0)
    pg (0.17.1)
    polyglot (0.3.5)
    powerbar (1.0.11)
      ansi (~> 1.4.0)
      hashie (>= 1.1.0)
    psych (2.0.6)
    rack (1.4.5)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-ssl (1.3.4)
      rack
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (3.2.21)
      actionmailer (= 3.2.21)
      actionpack (= 3.2.21)
      activerecord (= 3.2.21)
      activeresource (= 3.2.21)
      activesupport (= 3.2.21)
      bundler (~> 1.0)
      railties (= 3.2.21)
    rails_autolink (1.1.6)
      rails (> 3.1)
    railties (3.2.21)
      actionpack (= 3.2.21)
      activesupport (= 3.2.21)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    rake (10.4.2)
    rcov (0.9.11)
    rdoc (3.12.2)
      json (~> 1.4)
    redcarpet (3.2.0)
    ref (1.0.5)
    rest-client (1.7.2)
      mime-types (>= 1.16, < 3.0)
      netrc (~> 0.7)
    sass (3.4.7)
    sass-rails (3.2.6)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    snmp (1.2.0)
    sprockets (2.2.3)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sqlite3 (1.3.10)
    sshkit (1.7.1)
      colorize (>= 0.7.0)
      net-scp (>= 1.1.2)
      net-ssh (>= 2.8.0)
    therubyracer (0.12.1)
      libv8 (~> 3.16.14.0)
      ref
    thor (0.19.1)
    tilt (1.4.1)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.43)
    uglifier (2.5.3)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    webrick (1.3.1)

PLATFORMS
  ruby

DEPENDENCIES
  airbrake
  annotate (>= 2.6.0)
  awesome_print
  capistrano
  capistrano-bundler
  capistrano-passenger
  capistrano-rails
  capistrano-rvm
  coffee-rails (~> 3.2.1)
  daemons
  dbd-pg
  dbi
  delayed_job_active_record
  execjs
  jquery-rails
  jquery-ui-rails
  json
  minitest
  minitest-reporters (~> 0.14.24)
  pg
  psych
  rails (= 3.2.21)
  rails_autolink
  rcov (~> 0.9.1)
  redcarpet
  rest-client
  sass-rails (~> 3.2.3)
  snmp
  sqlite3
  therubyracer
  uglifier (~> 2.5.1)
  webrick (~> 1.3.1)
@betesh
Copy link
Contributor

betesh commented May 31, 2015

It's failing because in --dry-run, we don't actually run any commands, so we can't guess the passenger version. There's really no reasonable way to work around this, other than to log a fatal error and exit. I'm going to make this a more graceful process.

@Sevyls
Copy link
Author

Sevyls commented May 31, 2015

Thanks for your answer.
As i understand it, a dry run shouldn't change any state on the deployment's destination servers.
But how is running a command like passenger -v or any other version checking a bad thing?
I think in this form, the capistrano/passenger plugin in dry-run mode is unusable, even with a fatal error.

@betesh
Copy link
Contributor

betesh commented May 31, 2015

a dry run shouldn't change any state on the deployment's destination servers.

That may be one possible reasonable definition of dry run, but unfortunately, that's not how it's currently implemented in capistrano 3. A dry-run simply prints out all the commands it would run.

capistrano-passenger runs a command, and uses the result to decide what command to do next. If we just print out the command, but don't actually run it on the host, then we can't print out the next command, because we don't know what the next command will be.

We can stub a result (which other capistrano add-ons appear to do accidentally), but that would be misleading, if the intention is to give you a realistic idea of what commands will be run in real life.

Anyway, pull the latest from github and you'll see how I work around this. I'm planning on releasing an updated gem soon but waiting for feedback on a few issues first.

@pzgz
Copy link
Contributor

pzgz commented Jun 15, 2015

Got same error today, after debugging, found out it's because the remote command "passenger -v" is getting some error messages from rvm before the actually version showed up. In my case, they are something like

[32mRVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
DEBUG [791c8229] you can ignore these warnings with 'rvm rvmrc warning ignore > /home/park/park_deploy/current/Gemfile'.
DEBUG [791c8229] To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.
DEBUG [791c8229] [0m
DEBUG [791c8229] Phusion Passenger version 5.0.10

Because of these, the regular expression used to get version number returned nill, so the exception was throwed. Get rid of the warning message by running passenger -v command fixed the issue. Maybe a throught match for multiline is better in this case.

@betesh
Copy link
Contributor

betesh commented Jun 15, 2015

@pzgz Sounds reasonable. A PR would be welcome.

pzgz added a commit to pzgz/passenger that referenced this issue Jun 15, 2015
For capistrano#20 , if the version info returned by `passenger -v` is not the first line, the original regular expression will return nil so that error will be raised. This might happen sometime, such as RVM might give a warning when running a command.
betesh pushed a commit that referenced this issue Jun 16, 2015
For #20 , if the version info returned by `passenger -v` is not the first line, the original regular expression will return nil so that error will be raised. This might happen sometime, such as RVM might give a warning when running a command.
@mib32
Copy link

mib32 commented Jun 16, 2015

I also start to have this problem (not using dry run) after updating to passenger 5.0.10.

@mib32
Copy link

mib32 commented Jun 16, 2015

But i seem unable to use bleeding edge
gem 'capistrano-passenger', git: 'https://github.com/capistrano/passenger.git', branch: 'master'
It just doesn't work. Just refutes to be required.

@Sevyls Sevyls changed the title undefined method `[]' for nil:NilClass dry-run: undefined method `[]' for nil:NilClass Jun 16, 2015
@Sevyls Sevyls changed the title dry-run: undefined method `[]' for nil:NilClass passenger version & dry-run: undefined method `[]' for nil:NilClass Jun 16, 2015
@mib32
Copy link

mib32 commented Jun 16, 2015

Right, i had to build the gem.

$ cd `bundle show capistrano-passenger`
$ gem build capistrano-passenger.gemspec
$ gem install capistrano-passenger-0.1.0.gem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants