Sha256: 1a96f30d012c939e1866c2038d25d3c64e55b46d120e8a676862cca55f28c82f
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
require 'fog' require 'fog/core/ssh' # Monkey-patch Fog 1.3.1 to stream SSH output # (in real time) to stdout. class Fog::SSH::Real def run(commands) commands = [*commands] results = [] begin Net::SSH.start(@address, @username, @options) do |ssh| commands.each do |command| result = Fog::SSH::Result.new(command) ssh.open_channel do |ssh_channel| ssh_channel.request_pty ssh_channel.exec(command) do |channel, success| unless success raise "Could not execute command: #{command.inspect}" end channel.on_data do |ch, data| result.stdout << data puts data end channel.on_extended_data do |ch, type, data| next unless type == 1 result.stderr << data puts data end channel.on_request('exit-status') do |ch, data| result.status = data.read_long end channel.on_request('exit-signal') do |ch, data| result.status = 255 end end end ssh.loop results << result end end rescue Net::SSH::HostKeyMismatch => exception exception.remember_host! sleep 0.2 retry end results end end require "fog/digitalocean/models/compute/server" # Monkey patch Digital Ocean to properly return public_ip_address to used in scp Fog::Compute::DigitalOcean::Server.class_eval do def public_ip_address ip_address end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simple_provision-0.99.2 | lib/ext/fog.rb |