javan / javan/whenever

TypeError: no implicit conversion of nil into Hash

Open
#609 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

awaiting-feedback bugfix capistrano
Dominant language
Ruby
Stars
8.9k
Forks
715
PR merge metrics
No merged PRs in 30d

Description

Hi,

Here is my deploy.rb:

require 'whenever/capistrano'
...
set :whenever_identifier, ->{ "#{fetch(:application)}_#{fetch(:stage)}" }
set :whenever_roles, -> { [:web, :db, :app] }

production.rb

set :rails_env, :production

role :app, %w( ... )
role :web, %w( ... )
role :db,  %w( ... )

Yet it fails with the following:

TypeError: no implicit conversion of nil into Hash
gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:87:in `merge'
gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:87:in `with'
gems/whenever-0.9.4/lib/whenever/tasks/whenever.rake:8:in `block (2 levels) in setup_whenever_task'
gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:80:in `within'
gems/whenever-0.9.4/lib/whenever/tasks/whenever.rake:7:in `block in setup_whenever_task'
gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:29:in `run'
gems/sshkit-1.9.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => whenever:update_crontab
The deploy has failed with an error: no implicit conversion of nil into Hash

gems/whenever-0.9.4/lib/whenever/tasks/whenever.rake:8

        with fetch(:whenever_command_environment_variables) do
          execute *args_for_host
        end

I am using ruby 2.3 and capistrano 3.4.0, the same config works on the other app with the only difference is ruby version being 2.2. Is there anything I am missing?

If I remove whever_roles it doesn't fail but nothing gets added to crontab either.

Please advise, thanks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with whenever/tasks/whenever.rake at the with fetch(:whenever_command_environment_variables) call, then inspect the SSHKit merge shown in the trace. Reproduce with Ruby 2.3, Capistrano 3.4.0, and the provided role configuration, comparing the working Ruby 2.2 setup. Done means whenever:update_crontab completes and updates the intended hosts' crontabs without the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.