capistrano/capistrano

run_locally ignores --dry-run

开放

#1,822 创建于 2016年12月20日

 (5 条评论) (0 个反应) (0 位负责人)Ruby (1,750 个派生)batch import
discuss!help wanted

仓库指标

星标
 (12,952 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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

贡献者指南