capistrano/capistrano

run_locally ignores --dry-run

Open

#1822 aperta il 20 dic 2016

Vedi su GitHub
 (5 commenti) (0 reazioni) (0 assegnatari)Ruby (1750 fork)batch import
discuss!help wanted

Metriche repository

Star
 (12.952 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

run_locally ignores the --dry-run flag and runs anyway. This seems to be because in https://github.com/capistrano/capistrano/blob/master/lib/capistrano/dsl.rb#L68 the current sshkit backend is ignored and the local one is used directly.

Steps to reproduce

So with the following contrived test case:

namespace :test_case do
  desc 'A test for run_locally dry-run issue'
  task :testing do
    on roles(:app) do |host|
      run_locally do
        execute :echo, "fail"
      end
    end
  end
end

Then running it with cap --dry-run stage test_case:testing

Expected behavior

It should output:

00:00 test_case:testing
      01 echo fail

Like it does if you remove the run_locally block.

Actual behavior

It outputs:

00:00 test_case:testing
      01 echo fail
      01 fail
    ✔ 01 notroot@localhost 0.002s

Indicating it actually ran the program.

System configuration

doctor output: https://gist.github.com/BenoitHiller/fc0fd11b95bf4faa5f7cd34da34d0711

Guida contributor