Cosa fare quando Net-SSH lamenta exec! Metodo manca?
Domanda
Questo mi sta facendo impazzire. Mi imbatto in questo ogni ora e poi su un nuovo server ubuntu / debian. Fondamentalmente io non posso fare un exec! attraverso net-ssh. Si noti, che posso richiedere 'net / ssh' perfettamente bene.
codice di esempio
require 'rubygems'
require 'net/ssh'
Net::SSH.start('my.random.box', 'myuser', :forward_agent => "true") do |ssh|
#output = ssh.exec("hostname")
#puts output
output = ssh.exec!("hostname")
puts stdout
end
sistema di informazioni rilevanti all'ambiente
me@box:~$ gem list | grep net-ssh
net-ssh (2.0.11)
me@box:~$ which ruby
/usr/bin/ruby
me@box:~$ which gem
/usr/bin/gem
cyn0n@spicetrader:~$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.4
- RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /usr/lib/ruby/gems/1.8
- /home/me/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org/", "http://gems.github.com"]
- REMOTE SOURCES:
- http://gems.rubyforge.org/
- http://gems.github.com
Soluzione
Un paio di cose da provare:
- Verificare che l'exec! metodo è nella fonte.
- Controlla entrambi i repository gemma per assicurarsi che non ci sia una versione precedente net-ssh in là.
gem list
ha alcune stranezze; è più semplice andare solo nelle directory e vedere cosa c'è. -
require
la versione corrente nello script.require 'rubygems'
gem 'net-ssh', '=2.0.11'
require 'net-ssh'
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow