capistrano/capistrano

run_locally ignores --dry-run

Open

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

在 GitHub 查看
 (5 评论) (0 反应) (0 负责人)Ruby (12,952 star) (1,750 fork)batch import
discuss!help wanted

描述

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

贡献者指南

run_locally ignores --dry-run · capistrano/capistrano#1822 | Good First Issue