I'm using whenever/capistrano to update my cron_tab when deploying with capistrano, it was working great until recently my deploys started to fail when updating the cron_tab.
.rvm/gems/ruby-1.9.3-p362-turbo@psg-web/gems/capistrano-2.8.0/lib/capistrano/configuration/variables.rb:122:in `method_missing_with_variables': undefined method `role_names_for_host' for #<Capistrano::Configuration:0x000000018e6a10> (NoMethodError)
I am setting the *role_names_for_host*
set_default(:whenever_roles, [:workers])
and my tasks look like this
namespace :whenever do
desc "Stop whenever"
task :stop , roles: [:workers] do
clear_crontab
end
desc "Start whenever"
task :start , roles: [:workers] do
update_crontab
end
desc "Restart whenever"
task :restart , roles: [:workers] do
update_crontab
end
after 'deploy:symlink', 'whenever:update_crontab'
%w[start stop restart].each do |command|
after "deploy:#{command}", "whenever:#{command}"
end
end
Any Ideas on what I could be doing wrong?
Gem versions
- capistrano (2.8.0)
- whenever (0.8.2)
The method missing is introduced in capistrano after 2.9.0.
Patch: You can add this at the top of your Capfile or deploy.rb file:
I would recommend whenever updating it's gem dependencies :)
( source: https://github.com/javan/whenever/issues/302#issuecomment-14962350 )