**The slides are not correctly rendered. The HTML/Javascript version is here: http://presentations.pothix.com/rubyconf2013/**
This presentation shows what we have done with Ruby to create Locaweb's cloud computing product.
35. NET::SSH AS TRANSPORT LAYER
Net::SSH.start(@host, @user, ssh_options) do |ssh|
ssh_result = ssh.open_channel do |channel|
channel.request_pty do |chn, success|
raise "Could not obtain pty from ssh" unless success
chn[:out] = ""
chn.exec command
...
87. BLATHER AND DAEMON TOOLS
require 'blather/client'
DaemonKit::Application.running!
message :chat?, :body do |m|
begin
if Weatherman::Message.should_process?(m)
message = JSON.parse(m.body, :allow_nan => true)["results"]
unless message["event"].nil?
Weatherman::Message.process(message["event"])
end
end
rescue => e
DaemonKit.logger.error "Invalid message #{m.body}"
DaemonKit.logger.error e.backtrace
end
end
89. XEN POOL KNOWS ITS NETWORK VERSION
# -*- coding: UTF-8 -*-
module Network
module Manager
extend self
def for(pool)
pool.network_version.constantize.new
end
end
end
90. DIFFERENT BEHAVIORS FROM VERSION 1
# -*- coding: UTF-8 -*-
module Network
class Ver1
def internal_vlan?
true
end
def installation_ip(vm)
vm.public_ip.address
end
end
end
91. TO NETWORK VERSION 2
# -*- coding: UTF-8 -*-
module Network
class Ver2
def internal_vlan?
false
end
def installation_ip(vm)
vm.on_simplestack.ip
end
end
end