4

My root capistrano has a task that dumps the database: cap production dump or cap staging dump will dump the database.

Now, I want to define a task in staging that will run this task on production.

I could do

desc 'Updates the database of acceptance with the latest production database'
task :update_db do
  run_locally do
    execute :cap, 'production', 'dump'
    # move dump-file from production, via local, to acceptance
  end
  on roles(:db) do
    execute :rake, 'db:data:load'
  end
end

But running a cap task from a cap task via a shell feels ugly and fragile.

I found Calling a multistage capistrano task from within a capistrano task but that does not work, probably because its a solution for an old version of Capistrano.

Is there a way to run a certain capistrano task on a certain "stage" from within Capistrano?

Community
  • 1
  • 1
berkes
  • 26,996
  • 27
  • 115
  • 206
  • 1
    I walked through the source code for a little while and don't think this is possible… Really good idea though. – will_in_wi Aug 06 '15 at 14:10

0 Answers0