Sha256: 21d6b828c2ea142a74b325b3211f6e274b9b98a402f9b8e1429a658dbbe149fe
Contents?: true
Size: 1020 Bytes
Versions: 1
Compression:
Stored size: 1020 Bytes
Contents
require 'albacore/support/albacore_helper' require 'net/ssh' class Ssh include YAMLConfig include Logging attr_accessor :server, :username, :password, :commands, :port, :key, :debug def initialize super() @commands = [] end def get_connection_options options = {} options[:verbose] = :debug if @debug == true options[:password] = @password if @password options[:port] = @port if @port options[:keys] = [@key] if @key options end def execute() warn_about_key if @key Net::SSH.start(@server, @username, get_connection_options) do |ssh| @commands.each{|cmd| @logger.info "Executing remote command: #{cmd}" output = ssh.exec!(cmd) @logger.info 'SSH output: ' @logger.info output } end end def warn_about_key() info.debug 'When using a key, you need an SSH-Agent running to manage the keys.' info.debug 'On Windows, a recommended agent is called Pageant, downloadable from the Putty site.' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
albacore-0.0.8 | lib/albacore/ssh.rb |