Sha256: 6f0f473815a3542da9ac91950fb4fe21118e10dde7f678abbdca9e0f2103564e
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
class TestLab class Provisioner # Route Provisioner Error Class class RouteError < ProvisionerError; end # Route Provisioner Class # # @author Zachary Patten <zachary AT jovelabs DOT com> class Route def initialize(config={}, ui=nil) @config = (config || Hash.new) @ui = (ui || TestLab.ui) @config[:route] ||= Hash.new @ui.logger.debug { "config(#{@config.inspect})" } end # Route: Network Provision def on_network_provision(network) manage_route(:add, network) true end alias :on_network_up :on_network_provision # Route: Network Deprovision def on_network_deprovision(network) manage_route(:del, network) true end alias :on_network_down :on_network_deprovision def manage_route(action, network) command = ZTK::Command.new(:ui => @ui, :silence => true, :ignore_exit_status => true) case RUBY_PLATFORM when /darwin/ then action = ((action == :del) ? :delete : :add) command.exec(%(sudo route #{action} -net #{TestLab::Utility.network(network.address)} #{network.node.ip} #{TestLab::Utility.netmask(network.address)})) when /linux/ then command.exec(%(sudo route #{action} -net #{TestLab::Utility.network(network.address)} netmask #{TestLab::Utility.netmask(network.address)} gw #{network.node.ip})) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
testlab-1.0.1 | lib/testlab/provisioners/route.rb |