vendredi 17 juin 2016

Capistrano error - Invalid options(s): known_hosts

I'm trying to setup Capistrano as a proof of concept for my colleagues at work on a sub project I'm working on that has its own servers.

I've finished configuring everything and just need to run deploy for the first time, the SSH forwarding is all working, etc... but I'm getting an error I've not seen before and can't find any reference to how to resolve:

    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

So I think Capistrano is trying to run something with known_hosts as an option, but the thing it's trying to run it against doesn't recognise the option and hence deployment dies before it even tries to contact the server, the failure happens almost immediately as soon as I press enter on the cap slimqa01 deploy.

Anyone had a similar issue?

deploy.rb below:

# 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

I also get the error on just running individual tasks too:

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)

Aucun commentaire:

Enregistrer un commentaire