From 54fd0659d7592adf6aeed4ff13f9cbf2e5bf4919 Mon Sep 17 00:00:00 2001 From: nishiki Date: Tue, 6 Aug 2013 21:42:47 +0200 Subject: [PATCH] remove ssh connection in mpw --- Cli.rb | 3 --- MPW.rb | 31 ------------------------------- mpw | 8 -------- 3 files changed, 42 deletions(-) diff --git a/Cli.rb b/Cli.rb index e7e651d..84dd055 100755 --- a/Cli.rb +++ b/Cli.rb @@ -158,7 +158,4 @@ class Cli end - def ssh(search) - @m.ssh(search) - end end diff --git a/MPW.rb b/MPW.rb index 9cb1db6..0bf052a 100755 --- a/MPW.rb +++ b/MPW.rb @@ -6,7 +6,6 @@ require 'rubygems' require 'gpgme' require 'csv' -require 'net/ssh' require 'yaml' class MPW @@ -319,35 +318,5 @@ class MPW return false end end - - # Connect to ssh && display the password - # @args: file -> a string to match - # @rtrn: true if ssh connection work - def ssh(search) - result = self.search(search, 'ssh') - - if result.length > 0 - result.each do |r| - server = r[SERVER] - login = r[LOGIN] - port = r[PORT] - passwd = r[PASSWORD] - - if port.empty? - port = 22 - end - - if passwd.empty? - system("#{passwd} ssh #{login}@#{server} -p #{port}") - else - system("sshpass -p #{passwd} ssh #{login}@#{server} -p #{port}") - end - end - - return true - else - return false - end - end end diff --git a/mpw b/mpw index a8a8b6e..cf9ecbd 100755 --- a/mpw +++ b/mpw @@ -39,10 +39,6 @@ OptionParser.new do |opts| options[:setup] = true end - opts.on("-s", "--ssh SEARCH", "Connect to ssh") do |search| - options[:ssh] = search - end - opts.on("-p", "--protocol PROTOCOL", "Select a protocol") do |type| options[:type] = type end @@ -92,10 +88,6 @@ elsif not options[:remove].nil? elsif not options[:update].nil? cli.update(options[:update]) -# Connect to ssh -elsif not options[:ssh].nil? - cli.ssh(options[:ssh]) - # Add a new item elsif not options[:add].nil? cli.add()