Question

Has anyone out there seen this error before? I haven't been able to find any reference to SUPPORTED_TYPE in the source...

irb(main):013:0> connection = Net::SSH.start('host', 'user', :password => 'password') NameError: uninitialized constant Net::SSH::KnownHosts::SUPPORTED_TYPE from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.5.1/lib/net/ssh/known_hosts.rb:117:in `keys_for' from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.5.1/lib/net/ssh/known_hosts.rb:105:in `each_line' from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.5.1/lib/net/ssh/known_hosts.rb:105:in `keys_for' from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.5.1/lib/net/ssh/known_hosts.rb:103:in `open' from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.5.1/lib/net/ssh/known_hosts.rb:103:in `keys_for' from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.5.1/lib/net/ssh/known_hosts.rb:33:in `search_in' from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.5.1/lib/net/ssh/known_hosts.rb:33:in `map' from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.5.1/lib/net/ssh/known_hosts.rb:33:in `search_in' from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.5.1/lib/net/ssh/known_hosts.rb:27:in `search_for' from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.5.1/lib/net/ssh/transport/algorithms.rb:237:in `prepare_preferred_algorithms!' from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.5.1/lib/net/ssh/transport/algorithms.rb:120:in `initialize' from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.5.1/lib/net/ssh/transport/session.rb:79:in `new' from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.5.1/lib/net/ssh/transport/session.rb:79:in `initialize' from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.5.1/lib/net/ssh.rb:186:in `new' from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.5.1/lib/net/ssh.rb:186:in `start' from (irb):13 from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1313
Was it helpful?

Solution

The easier solution is to use this forked version of net-ssh which fixes that issue (the next release of the official net-ssh gem should fix it as well) as described here.

If you have that issue while deploying through capistrano (which I had today), you can install this net-ssh version from github through the Gemfile and then call cap by using bundle exec cap deploy.

Put in the Gemfile gem 'net-ssh', :git => 'git://github.com/nessche/net-ssh.git'.

OTHER TIPS

This is a problem that seems to have been introduced by the May 24th updates 2.5.0 or 2.5.1 to the net-ssh gem. You can find the constant SUPPORTED_TYPE here:

http://net-ssh.github.com/net-ssh/classes/Net/SSH/KnownHosts.html

I don't know all the details, but there have been a couple solutions to this issue so far. One is to remove your known_hosts file (or the particular host you're trying to connect to from that file), and you might be able to connect until that host is added to known_hosts again -- it will return the same error if it's in there, for some reason.

The second option I've found is to revert to version 2.4.0 of the gem. I've submitted a ticket for the issue at:

http://net-ssh.lighthouseapp.com/projects/36253-net-ssh/tickets/58-nameerror-uninitialized-constant-netsshknownhostssupported_type

Hope it helps!

EDIT: Clarif's solution to this looks like a more acceptable one. Thanks, Clarif!

After following the issues on github and also applying what clarif suggested, I came up with this that fixed my problem.

http://tinyurl.com/cxr2xa3

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top