我正在尝试使用knife solo
和vagrant
来测试厨师食谱。
使用vagrant ssh-config
提供的信息,我可以按如下方式连接到我的流浪主机:
ssh -p 3774 -i /path/to/.vagrant/machines/default/virtualbox/private_key vagrant@localhost
我打电话给knife solo
:
knife solo prepare -p 3774 -i /path/to/.vagrant/machines/default/virtualbox/private_key vagrant@localhost -VV
引发例外:
ERROR: Net::SSH::ConnectionTimeout: Net::SSH::ConnectionTimeout
堆栈追踪:
Bootstrapping Chef...
/usr/local/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/session.rb:90:in `rescue in initialize': Net::SSH::ConnectionTimeout (Net::SSH::ConnectionTimeout)
from /usr/local/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/session.rb:57:in `initialize'
from /usr/local/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh.rb:232:in `new'
from /usr/local/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh.rb:232:in `start'
from /usr/local/lib/ruby/gems/2.4.0/gems/knife-solo-0.6.0/lib/knife-solo/ssh_connection.rb:42:in `session'
from /usr/local/lib/ruby/gems/2.4.0/gems/knife-solo-0.6.0/lib/knife-solo/ssh_command.rb:153:in `try_connection'
from /usr/local/lib/ruby/gems/2.4.0/gems/knife-solo-0.6.0/lib/knife-solo/ssh_command.rb:194:in `detect_authentication_method'
from /usr/local/lib/ruby/gems/2.4.0/gems/knife-solo-0.6.0/lib/knife-solo/ssh_command.rb:290:in `run_command'
from /usr/local/lib/ruby/gems/2.4.0/gems/knife-solo-0.6.0/lib/chef/knife/solo_prepare.rb:71:in `operating_system'
from /usr/local/lib/ruby/gems/2.4.0/gems/knife-solo-0.6.0/lib/chef/knife/solo_prepare.rb:67:in `bootstrap'
from /usr/local/lib/ruby/gems/2.4.0/gems/knife-solo-0.6.0/lib/chef/knife/solo_prepare.rb:57:in `run'
from /usr/local/lib/ruby/gems/2.4.0/gems/chef-13.2.20/lib/chef/knife.rb:442:in `block in run_with_pretty_exceptions'
from /usr/local/lib/ruby/gems/2.4.0/gems/chef-13.2.20/lib/chef/local_mode.rb:44:in `with_server_connectivity'
from /usr/local/lib/ruby/gems/2.4.0/gems/chef-13.2.20/lib/chef/knife.rb:441:in `run_with_pretty_exceptions'
from /usr/local/lib/ruby/gems/2.4.0/gems/chef-13.2.20/lib/chef/knife.rb:219:in `run'
from /usr/local/lib/ruby/gems/2.4.0/gems/chef-13.2.20/lib/chef/application/knife.rb:156:in `run'
from /usr/local/lib/ruby/gems/2.4.0/gems/chef-13.2.20/bin/knife:25:in `<top (required)>'
from /usr/local/bin/knife:22:in `load'
from /usr/local/bin/knife:22:in `<main>'
不确定可能导致knife solo
失败的原因。我也试过指定-P
流浪汉密码而不是身份文件,效果相同。
如何将knife solo
连接到本地主机?
谢谢你的帮助!