Sha256: ffdbf177015d5fe2baa58ce978d4da019818ca806db7df41dfad92465073811a
Contents?: true
Size: 940 Bytes
Versions: 1
Compression:
Stored size: 940 Bytes
Contents
module Utils # Utility methods for doing things over SSH module SSH # Intelligently do some things over SSH def over_ssh(opts = {}) result = {} fail "MissingSSHHost" unless opts[:host] fail "MissingSSHUser" unless opts[:user] opts[:timeout] ||= 300 # default to a 5 minute timeout remote = Rye::Box.new( opts[:host], user: opts[:user], auth_methods: ['publickey'], password_prompt: false ) exception = nil output = begin Timeout::timeout(opts[:timeout]) do yield remote # pass our host back to the user to work with end rescue Exception => e exception = e ensure remote.disconnect end result[:exception] = exception result[:exit_status] = output.exit_status result[:stdout] = output.stdout result[:stderr] = output.stderr return result end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lita-puppet-0.3.0 | lib/utils/ssh.rb |