lib/ssh/manager/cli.rb in ssh-manager-1.0.6 vs lib/ssh/manager/cli.rb in ssh-manager-1.0.7

- old
+ new

@@ -61,9 +61,20 @@ else puts "Version: #{old_version} is up to date." end end + def ping(id) + via = DATABASE.get_connection_data[id.to_i-1][-1] =~ /@/ + @ip = DATABASE.get_connection_data[id.to_i-1][0] + if via.nil? + exec("ping #{@ip}") + else + via = DATABASE.get_connection_data[id.to_i-1][-1] + exec("ssh #{via} ping #{@ip}") + end + end + def transfer_key(id) @ip = DATABASE.get_connection_data[id.to_i-1][0] @user = DATABASE.get_connection_data[id.to_i-1][1] %x(ssh-copy-id #{@user}@#{@ip}) end