NameError while doing cap deploy #45

Closed
mdemare opened this Issue May 24, 2012 · 16 comments

7 participants

@mdemare

This is on 2.5.1

NameError: uninitialized constant Net::SSH::KnownHosts::SUPPORTED_TYPE

@pyromaniac

Yep, got it too.

@delano
Collaborator

What OS/Ruby version? Can you paste a full stack trace?

@magic0fei

Same here. I'm running Mac OX Lion 10.7.4, ruby version is 1.9.3-p194.

@davidsun

Got same error on Gentoo Linux, with ruby 1.9.3-p0.

@delano
Collaborator

Interesting. I don't see this on either test machine (OS X 10.6.8, CentOS 6) without Capistrano.

What is cap deploy doing to cause it? Any help/guidance appreciated.

@mdemare

$ irb

require 'net/ssh'
Net::SSH::KnownHosts::SUPPORTED_TYPE

NameError: uninitialized constant Net::SSH::KnownHosts::SUPPORTED_TYPE

You've defined the constant in a class <<self block.

@delano
Collaborator

Again, I don't see get that error on either test machine. Happy to merge in a pull request.

@nessche

@delano Check my pull request #46

@nessche

I ran simplecov on the test_all.rb script, and it appears that the line whre originally SUPPORTED_TYPE was referred to is not covered by the tests.

http://i46.tinypic.com/34pl7df.png

I ran the test on my branch so the culprit line reads now "next unless KnownHosts.supported_types.include? .....", but it still shows the reason why the gem tests did not discover the problem.

@mdemare

Here's an explanation for why it's broken: http://stackoverflow.com/q/5250323/136

@delano
Collaborator

Marco, thanks for the follow up. I believe the right solution is to move the SUPPORTED_TYPE constant from the metaclass to the class itself.

Btw for everyone reading, I'm a maintainer for this lib and not a developer which is why I put an emphasis on pull requests (see: http://solutious.com/blog/2009/06/19/net-ssh-repository/ ).

If someone can submit a patch with a test, I'll pull it into the repo and make a new release.

@nessche

@delano : Agreed, I will move the whole if/else branch to the class, test it (just wrote the tests for it) and push it...

@simonc

Any news on that subject ?

@nessche

Fixed in 2.5.2 to the best of my knowledge

@simonc

Ok that's a good news, Il try to remove the gem 'net-ssh', '2.4.0' from my Gemfile and see if it's working :)

@simonc

Yup it's working !
I guess the issue could be closed :)

@delano delano closed this Aug 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment