Hi all,
Iam trying to pass a variabel to a net/ssh Iam using it like this
@conn_ip = edit_line
and in the net ssh call Net::SSH.start( "#{@conn_ip}",
I love the shoe :) but it feels like Iam missing the obvious
as always any help is appreciated
/Per
@conn_ip.text should do it. ----------------------- i5m.co.uk GPG Key: 0xA18A602B On Wed, Sep 14, 2011 at 1:11 PM, Per Mikaelsson <mr.mikaelsson@gmail.com> wrote: > Hi all, > > Iam trying to pass a variabel to a net/ssh Iam using it like this > > @conn_ip = edit_line > > and in the net ssh call Net::SSH.start( "#{@conn_ip}", > > I love the shoe :) but it feels like Iam missing the obvious > as always any help is appreciated > > /Per >
================================================== [2011-09-14T14:55:54+02:00]$ ruby "I:\ruby\sho.rb" ================================================== C:/Ruby192/lib/ruby/site_ruby/1.9.1/net/ssh/transport/session.rb:65:in `initialize': getaddrinfo: No such host is known. from C:/Ruby192/lib/ruby/site_ruby/1.9.1/net/ssh/transport/session.rb:65:in `open' from C:/Ruby192/lib/ruby/site_ruby/1.9.1/net/ssh/transport/session.rb:65:in `block in initialize' from C:/Ruby192/lib/ruby/1.9.1/timeout.rb:44:in `timeout' from C:/Ruby192/lib/ruby/1.9.1/timeout.rb:89:in `timeout' from C:/Ruby192/lib/ruby/site_ruby/1.9.1/net/ssh/transport/session.rb:65:in `initialize' from C:/Ruby192/lib/ruby/site_ruby/1.9.1/net/ssh.rb:183:in `new' from C:/Ruby192/lib/ruby/site_ruby/1.9.1/net/ssh.rb:183:in `start' from I:/ruby/sho.rb:22:in `block (3 levels) in <main>' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/green_shoes-1.0.282/lib/shoes/app.rb:210:in `block in button' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/green_shoes-1.0.282/lib/shoes/main.rb:105:in `call' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/green_shoes-1.0.282/lib/shoes/main.rb:105:in `main' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/green_shoes-1.0.282/lib/shoes/main.rb:105:in `app' from I:/ruby/sho.rb:15:in `<main>' C:/Ruby192/lib/ruby/gems/1.9.1/gems/green_shoes-1.0.282/lib/shoes/ruby.rb:106:in `exit': wrong number of arguments (1 for 0) (ArgumentError) from C:/Ruby192/lib/ruby/gems/1.9.1/gems/glib2-1.0.0-x86-mingw32/lib/glib2.rb:32:in `exit_application' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/green_shoes-1.0.282/lib/shoes/main.rb:105:in `main' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/green_shoes-1.0.282/lib/shoes/main.rb:105:in `app' from I:/ruby/sho.rb:15:in `<main>'
Hi Per, Could you show us the code (sho.rb) ? ashbb
Sure I can,
#Shoes.setup do
# gem 'net-ssh'
# gem 'green_shoes'
#end
require 'green_shoes'
require 'rubygems'
require 'net/ssh'
#@fw = ""
#while (@fw == "") do
# print "Firewall IP: "
# @fw = gets.chomp
#end
Shoes.app do
background red
stack do
@conn_ip.text = edit_line.text
end
stack do
button "Connect" do
Net::SSH.start( '#{@conn_ip.text}', 'xxxx', :password => "xxxxx" ) do
|ssh|
$output = ssh.exec! ('ls -la')
para alert "#{$output}"
end
end
end
end
2011/9/14 ashbb <ashbbb@gmail.com>
> Hi Per,
>
> Could you show us the code (sho.rb) ?
>
> ashbb
>
@conn_ip.text = edit_line.text
should be:
@conn_ip = edit_line
You need the edit_line object from which you then can retrieve the text.
The rest should be fine, on a first sight.
oh wait,
para alert "#{$output}"
looks strange, it should be either para or alert I guess.
Tobi
On 09/14/2011 03:46 PM, Per Mikaelsson wrote:
> Sure I can,
>
> #Shoes.setup do
> # gem 'net-ssh'
> # gem 'green_shoes'
> #end
> require 'green_shoes'
> require 'rubygems'
> require 'net/ssh'
>
> #@fw = ""
> #while (@fw == "") do
> # print "Firewall IP: "
> # @fw = gets.chomp
> #end
>
> Shoes.app do
> background red
> stack do
> @conn_ip.text = edit_line.text
> end
> stack do
> button "Connect" do
> Net::SSH.start( '#{@conn_ip.text}', 'xxxx', :password => "xxxxx"
) do |ssh|
> $output = ssh.exec! ('ls -la')
> para alert "#{$output}"
> end
> end
> end
> end
>
> 2011/9/14 ashbb<ashbbb@gmail.com<mailto:ashbbb@gmail.com>>
>
> Hi Per,
>
> Could you show us the code (sho.rb) ?
>
> ashbb
>
>
Then I get same error as i log.txt 2011/9/14 Tobias Pfeiffer <tobias.pfeiffer@student.hpi.uni-potsdam.de> > @conn_ip.text = edit_line.text > > should be: > > @conn_ip = edit_line > > > You need the edit_line object from which you then can retrieve the text. > The rest should be fine, on a first sight. > > oh wait, > > para alert "#{$output}" > > looks strange, it should be either para or alert I guess. > > Tobi > > On 09/14/2011 03:46 PM, Per Mikaelsson wrote: > > Sure I can, > > > > #Shoes.setup do > > # gem 'net-ssh' > > # gem 'green_shoes' > > #end > > require 'green_shoes' > > require 'rubygems' > > require 'net/ssh' > > > > #@fw = "" > > #while (@fw == "") do > > # print "Firewall IP: " > > # @fw = gets.chomp > > #end > > > > Shoes.app do > > background red > > stack do > > @conn_ip.text = edit_line.text > > end > > stack do > > button "Connect" do > > Net::SSH.start( '#{@conn_ip.text}', 'xxxx', :password => "xxxxx" ) > do |ssh| > > $output = ssh.exec! ('ls -la') > > para alert "#{$output}" > > end > > end > > end > > end > > > > 2011/9/14 ashbb<ashbbb@gmail.com<mailto:ashbbb@gmail.com>> > > > > Hi Per, > > > > Could you show us the code (sho.rb) ? > > > > ashbb > > > > > >
C:/Ruby192/lib/ruby/site_ruby/1.9.1/net/ssh/transport/session.rb:65:in `initialize': getaddrinfo: No such host is known. This is not a shoes problem but rather a problem with the ssh gem or more likely your use of the ssh gem. Try Net::SSH.start( @conn_ip.text, 'xxxx', :password => "xxxxx" ) Tobi On 09/14/2011 04:26 PM, Per Mikaelsson wrote: > Then I get same error as i log.txt > > 2011/9/14 Tobias Pfeiffer<tobias.pfeiffer@student.hpi.uni-potsdam.de > <mailto:tobias.pfeiffer@student.hpi.uni-potsdam.de>> > > @conn_ip.text = edit_line.text > > should be: > > @conn_ip = edit_line > > > You need the edit_line object from which you then can retrieve the text. > The rest should be fine, on a first sight. > > oh wait, > > para alert "#{$output}" > > looks strange, it should be either para or alert I guess. > > Tobi > > On 09/14/2011 03:46 PM, Per Mikaelsson wrote: > > Sure I can, > > > > #Shoes.setup do > > # gem 'net-ssh' > > # gem 'green_shoes' > > #end > > require 'green_shoes' > > require 'rubygems' > > require 'net/ssh' > > > > #@fw = "" > > #while (@fw == "") do > > # print "Firewall IP: " > > # @fw = gets.chomp > > #end > > > > Shoes.app do > > background red > > stack do > > @conn_ip.text = edit_line.text > > end > > stack do > > button "Connect" do > > Net::SSH.start( '#{@conn_ip.text}', 'xxxx', :password => "xxxxx" ) > do |ssh| > > $output = ssh.exec! ('ls -la') > > para alert "#{$output}" > > end > > end > > end > > end > > > > 2011/9/14 ashbb<ashbbb@gmail.com > <mailto:ashbbb@gmail.com><mailto:ashbbb@gmail.com<mailto:ashbbb@gmail.com>>> > > > > Hi Per, > > > > Could you show us the code (sho.rb) ? > > > > ashbb > > > > > >
You are absolutely right, I was so sure I tried that... Really BIG thanks for the help. Regards Per 2011/9/14 Tobias Pfeiffer <tobias.pfeiffer@student.hpi.uni-potsdam.de> > C:/Ruby192/lib/ruby/site_ruby/1.9.1/net/ssh/transport/session.rb:65:in > `initialize': getaddrinfo: No such host is known. > > This is not a shoes problem but rather a problem with the ssh gem or > more likely your use of the ssh gem. Try > > Net::SSH.start( @conn_ip.text, 'xxxx', :password => "xxxxx" ) > > > Tobi > > On 09/14/2011 04:26 PM, Per Mikaelsson wrote: > > Then I get same error as i log.txt > > > > 2011/9/14 Tobias Pfeiffer<tobias.pfeiffer@student.hpi.uni-potsdam.de > > <mailto:tobias.pfeiffer@student.hpi.uni-potsdam.de>> > > > > @conn_ip.text = edit_line.text > > > > should be: > > > > @conn_ip = edit_line > > > > > > You need the edit_line object from which you then can retrieve the > text. > > The rest should be fine, on a first sight. > > > > oh wait, > > > > para alert "#{$output}" > > > > looks strange, it should be either para or alert I guess. > > > > Tobi > > > > On 09/14/2011 03:46 PM, Per Mikaelsson wrote: > > > Sure I can, > > > > > > #Shoes.setup do > > > # gem 'net-ssh' > > > # gem 'green_shoes' > > > #end > > > require 'green_shoes' > > > require 'rubygems' > > > require 'net/ssh' > > > > > > #@fw = "" > > > #while (@fw == "") do > > > # print "Firewall IP: " > > > # @fw = gets.chomp > > > #end > > > > > > Shoes.app do > > > background red > > > stack do > > > @conn_ip.text = edit_line.text > > > end > > > stack do > > > button "Connect" do > > > Net::SSH.start( '#{@conn_ip.text}', 'xxxx', :password => > "xxxxx" ) > > do |ssh| > > > $output = ssh.exec! ('ls -la') > > > para alert "#{$output}" > > > end > > > end > > > end > > > end > > > > > > 2011/9/14 ashbb<ashbbb@gmail.com > > <mailto:ashbbb@gmail.com><mailto:ashbbb@gmail.com<mailto: > ashbbb@gmail.com>>> > > > > > > Hi Per, > > > > > > Could you show us the code (sho.rb) ? > > > > > > ashbb > > > > > > > > > > > >
Hi, supplying the error would be appreciated ;-) I believe that "@conn_ip.text" is what you are looking for. Tobi On 09/14/2011 02:11 PM, Per Mikaelsson wrote: > Hi all, > > Iam trying to pass a variabel to a net/ssh Iam using it like this > > @conn_ip = edit_line > > and in the net ssh call Net::SSH.start( "#{@conn_ip}", > > I love the shoe :) but it feels like Iam missing the obvious > as always any help is appreciated > > /Per