Sha256: 8f80b824dfa4b69e86e5168e5d5d6d40b9e388efef1f4fe21c29294ff9dbd557
Contents?: true
Size: 1.82 KB
Versions: 3
Compression:
Stored size: 1.82 KB
Contents
class TestLab class Network module Lifecycle # Network Setup def setup @ui.logger.debug { "Network Setup: #{self.id} " } (self.node.state != :running) and return false (self.state == :not_created) and return false please_wait(:ui => @ui, :message => format_object_action(self, 'Setup', :green)) do self.network_provisioners.each do |provisioner| @ui.logger.info { ">>>>> NETWORK PROVISIONER SETUP: #{provisioner} (#{self.bridge}) <<<<<" } p = provisioner.new(self.config, @ui) p.respond_to?(:on_network_setup) and p.on_network_setup(self) end end true end # Network Teardown def teardown @ui.logger.debug { "Network Teardown: #{self.id} " } (self.node.state != :running) and return false (self.state == :not_created) and return false please_wait(:ui => @ui, :message => format_object_action(self, 'Teardown', :red)) do self.network_provisioners.each do |provisioner| @ui.logger.info { ">>>>> NETWORK PROVISIONER TEARDOWN: #{provisioner} (#{self.bridge}) <<<<<" } p = provisioner.new(self.config, @ui) p.respond_to?(:on_network_teardown) and p.on_network_teardown(self) end end true end # Build the network def build self.create self.up self.setup true end # Demolish the network def demolish self.teardown self.down self.destroy true end # Returns all defined provisioners for this network's containers and the network iteself. def network_provisioners [self.provisioners, self.interfaces.map(&:container).map(&:provisioners)].flatten.compact.uniq end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
testlab-0.9.1 | lib/testlab/network/lifecycle.rb |
testlab-0.9.0 | lib/testlab/network/lifecycle.rb |
testlab-0.8.6 | lib/testlab/network/lifecycle.rb |