【发布时间】:2016-06-16 17:01:49
【问题描述】:
我正在尝试将 Capistrano 设置为我的同事在我正在处理的一个拥有自己的服务器的子项目中工作的概念证明。
我已经完成了所有配置,只需要第一次运行部署,SSH 转发一切正常,等等......但是我遇到了一个我以前从未见过的错误并且找不到任何错误参考如何解决:
andrefigueira@Ubuntu ~/Code/dashboard $ cap slimqa01 deploy --trace
** Invoke slimqa01 (first_time)
** Execute slimqa01
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke deploy (first_time)
** Execute deploy
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
** Execute deploy:check
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
00:00 git:wrapper
01 mkdir -p /tmp/dashboard-capistrano/
cap aborted!
ArgumentError: invalid option(s): known_hosts
/usr/lib/ruby/vendor_ruby/net/ssh.rb:194:in `start'
/var/lib/gems/2.3.0/gems/sshkit-1.11.0/lib/sshkit/backends/connection_pool.rb:59:in `call'
/var/lib/gems/2.3.0/gems/sshkit-1.11.0/lib/sshkit/backends/connection_pool.rb:59:in `with'
/var/lib/gems/2.3.0/gems/sshkit-1.11.0/lib/sshkit/backends/netssh.rb:149:in `with_ssh'
/var/lib/gems/2.3.0/gems/sshkit-1.11.0/lib/sshkit/backends/netssh.rb:102:in `execute_command'
/var/lib/gems/2.3.0/gems/sshkit-1.11.0/lib/sshkit/backends/abstract.rb:141:in `block in create_command_and_execute'
/var/lib/gems/2.3.0/gems/sshkit-1.11.0/lib/sshkit/backends/abstract.rb:141:in `tap'
/var/lib/gems/2.3.0/gems/sshkit-1.11.0/lib/sshkit/backends/abstract.rb:141:in `create_command_and_execute'
/var/lib/gems/2.3.0/gems/sshkit-1.11.0/lib/sshkit/backends/abstract.rb:74:in `execute'
/var/lib/gems/2.3.0/gems/capistrano-3.5.0/lib/capistrano/tasks/git.rake:16:in `block (3 levels) in <top (required)>'
/var/lib/gems/2.3.0/gems/sshkit-1.11.0/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
/var/lib/gems/2.3.0/gems/sshkit-1.11.0/lib/sshkit/backends/abstract.rb:29:in `run'
/var/lib/gems/2.3.0/gems/sshkit-1.11.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => git:check => git:wrapper
The deploy has failed with an error: invalid option(s): known_hosts
** Invoke deploy:failed (first_time)
** Execute deploy:failed
** DEPLOY FAILED
所以我认为 Capistrano 正在尝试使用 known_hosts 作为选项运行某些东西,但是它试图运行它的东西无法识别该选项,因此部署在它甚至尝试联系服务器之前就死了,几乎发生了失败我在cap slimqa01 deploy 上按回车后立即。
有人遇到过类似的问题吗?
在下面部署.rb:
# config valid only for current version of Capistrano
lock '3.5.0'
set :application, 'dashboard-capistrano'
set :repo_url, 'git@github.com:private/repo.git'
# Default branch is :master
ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
# Default deploy_to directory is /var/www/my_app_name
set :deploy_to, '/var/www/dashboard-capistrano'
# Default value for :scm is :git
set :scm, :git
# Default value for :format is :airbrussh.
set :format, :airbrussh
# You can configure the Airbrussh format using :format_options.
# These are the defaults.
set :format_options, command_output: true, log_file: 'log/capistrano.log', color: :auto, truncate: :auto
# Default value for :pty is false
# set :pty, true
# Default value for :linked_files is []
# set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
# Default value for linked_dirs is []
# set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/system')
# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
# Default value for keep_releases is 5
set :keep_releases, 5
set :ssh_options, {
verbose: :debug
}
task :whoami do
on roles(:web) do
execute :whoami
end
end
namespace :deploy do
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
end
我也遇到了仅运行单个任务的错误:
andrefigueira@Ubuntu ~/Code/dashboard $ cap slimqa01 whoami
00:00 whoami
01 whoami
(Backtrace restricted to imported tasks)
cap aborted!
ArgumentError: invalid option(s): known_hosts
Tasks: TOP => whoami
(See full trace by running task with --trace)
【问题讨论】:
-
你能发布你的
deploy.rb吗? -
@patkoper 已发布
-
这很奇怪正在使用什么版本的
net-ssh,因为对 VALID_OPTIONS 和:known_hosts进行检查的行在当前版本中是 VALID_OPTION。似乎这是在 3.1 中作为选项添加的尝试将其添加到您的 Gemfile 中? (gem net-ssh, ">= 3.1") -
查看 Capistrano 问题后,似乎在
3.5.0github.com/capistrano/sshkit/issues/351 中引入了一个错误,尝试降级到3.4.0 -
干杯,我试试看!
标签: php ruby git capistrano capistrano3