Sha256: 6bd8e0dab796eade076e17b12e448698151d5426bb7c3b692c74194ab1416a18
Contents?: true
Size: 1.68 KB
Versions: 12
Compression:
Stored size: 1.68 KB
Contents
class TestLab class Node module Lifecycle # Bootstrap the node def node_setup node_setup_template = File.join(self.class.template_dir, 'node-setup.erb') self.ssh.bootstrap(ZTK::Template.render(node_setup_template)) end # Setup the node. def setup @ui.logger.debug { "Node Setup: #{self.id} " } please_wait(:ui => @ui, :message => format_object_action(self, 'Setup', :green)) do self.all_provisioners.each do |provisioner| @ui.logger.info { ">>>>> NODE PROVISIONER SETUP: #{provisioner} <<<<<" } p = provisioner.new(self.config, @ui) p.respond_to?(:on_node_setup) and p.on_node_setup(self) end end true end # Teardown the node. def teardown @ui.logger.debug { "Node Teardown: #{self.id} " } (self.state == :not_created) and return false please_wait(:ui => @ui, :message => format_object_action(self, 'Teardown', :red)) do self.all_provisioners.each do |provisioner| @ui.logger.info { ">>>>> NODE PROVISIONER TEARDOWN: #{provisioner} <<<<<" } p = provisioner.new(self.config, @ui) p.respond_to?(:on_node_teardown) and p.on_node_teardown(self) end end true end # Build the node def build self.create self.up self.setup true end # Returns all defined provisioners for this node and it's networks and containers. def all_provisioners [self.provisioners, self.networks.map(&:provisioners), self.containers.map(&:provisioners)].flatten.compact.uniq end end end end
Version data entries
12 entries across 12 versions & 1 rubygems