Uploaded image for project: 'Beaker'
  1. Beaker
  2. BKR-1655

Beaker throws and exception ArgumentError: invalid option(s): strict_host_key_checking at provision step (beaker-vagrant issue)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: beaker-vagrant
    • Labels:
      None
    • Environment:
    • Template:
    • Method Found:
      Needs Assessment
    • QA Risk Assessment:
      Needs Assessment

      Description

      When I updated beaker-vagrant in my project from 0.6.2 to 0.6.6, beaker started throwing an exception at provision stage. Here is how it looks like:

       

      ==> node1: Machine 'node1' has a post `vagrant up` message. This is a message
      ==> node1: from the creator of the Vagrantfile, and not from Vagrant itself:
      ==> node1: 
      ==> node1: Vanilla Debian box. See https://app.vagrantup.com/debian for help and bug reports
      configure vagrant boxes (set ssh-config, switch to root user, hack etc/hosts)
      Give root a copy of current user's keys, on node1node1 02:26:37$ sudo su -c "cp -r .ssh /root/."
        Attempting ssh connection to 172.16.0.2, user: vagrant, opts: {:config=>false, :verify_host_key=>false, :auth_methods=>["none", "publickey", "keyboard-interactive"], :port=>2222, :forward_agent=>true, :keys=>["/home/q/.vagrant.d/insecure_private_key"], :user_known_hosts_file=>"/dev/null", :keepalive=>true, :host_name=>"127.0.0.1", :user=>"vagrant", :strict_host_key_checking=>false, :keys_only=>true}An error occurred while loading ./spec/acceptance/k8s_spec.rb.
      Failure/Error: require 'beaker-rspec/spec_helper'
      ArgumentError:
        invalid option(s): strict_host_key_checking
        
      # /home/q/.rvm/gems/ruby-2.5.1/gems/net-ssh-6.0.2/lib/net/ssh.rb:221:in `start'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/ssh_connection.rb:71:in `connect_block'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/ssh_connection.rb:101:in `connect'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/ssh_connection.rb:43:in `connect'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/host.rb:297:in `connection'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/host.rb:357:in `block (2 levels) in exec'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/logger.rb:239:in `with_indent'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/host.rb:356:in `block in exec'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/host.rb:355:in `exec'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/host_prebuilt_steps.rb:370:in `block in copy_ssh_to_root'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/shared/host_manager.rb:130:in `run_block_on'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/dsl/patterns.rb:37:in `block_on'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/host_prebuilt_steps.rb:343:in `copy_ssh_to_root'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-vagrant-0.6.6/lib/beaker/hypervisor/vagrant.rb:163:in `block in set_all_ssh_config'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-vagrant-0.6.6/lib/beaker/hypervisor/vagrant.rb:151:in `each'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-vagrant-0.6.6/lib/beaker/hypervisor/vagrant.rb:151:in `set_all_ssh_config'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-vagrant-0.6.6/lib/beaker/hypervisor/vagrant.rb:281:in `provision'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/hypervisor.rb:37:in `create'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/network_manager.rb:72:in `block in provision'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/network_manager.rb:71:in `each_key'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-4.23.1/lib/beaker/network_manager.rb:71:in `provision'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-rspec-6.2.4/lib/beaker-rspec/beaker_shim.rb:35:in `provision'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-rspec-6.2.4/lib/beaker-rspec/spec_helper.rb:50:in `block in <top (required)>'
      # /home/q/.rvm/gems/ruby-2.5.1/gems/beaker-rspec-6.2.4/lib/beaker-rspec/spec_helper.rb:5:in `<top (required)>'
      # ./spec/spec_helper_acceptance.rb:3:in `require'
      # ./spec/spec_helper_acceptance.rb:3:in `<top (required)>'
      # ./spec/acceptance/k8s_spec.rb:3:in `require'
      # ./spec/acceptance/k8s_spec.rb:3:in `<top (required)>'
      No examples found.
       
       
      0 examples, 0 failures, 1 error occurred outside of examples/home/q/.rvm/rubies/ruby-2.5.1/bin/ruby -I/home/q/.rvm/gems/ruby-2.5.1/gems/rspec-core-3.9.2/lib:/home/q/.rvm/gems/ruby-2.5.1/gems/rspec-support-3.9.3/lib /home/q/.rvm/gems/ruby-2.5.1/gems/rspec-core-3.9.2/exe/rspec spec/acceptance/k8s_spec.rb failed

      I've managed to locate the problem more precisely. The problem is that beaker-vagrant 0.6.6 parses vagrant ssh-config output and instantiates Beaker::Host and sets its host_hash['ssh'] with parameter :strict_host_key_checking. This parameter isn't supported by net-ssh as shown below:

       

          def self.start(host, user=nil, options={}, &block)
            invalid_options = options.keys - VALID_OPTIONS
            # VALID_OPTIONS doesn't contain :strict_host_key_checking and therefore throws and exception
            if invalid_options.any?
              raise ArgumentError, "invalid option(s): #{invalid_options.join(', ')}"
            end
      

      beaker-vagrant 0.6.2 has another logic and passes ssh parameters in a file:

      $ diff beaker-vagrant-0.6.2/lib/beaker/hypervisor/vagrant.rb beaker-vagrant-0.6.6/lib/beaker/hypervisor/vagrant.rb
      204c204,206
      <         host['ssh'] = {:config => f.path()}
      ---
      > 
      >         host[:vagrant_ssh_config] = f.path
      >         host['ssh'] = host['ssh'].merge(Net::SSH.configuration_for(host['ip'], f.path))
      
      

       

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            kozl Kozlov Alexander
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support