class Topo::Provision::NodeGroupGenerator
Attributes
size[R]
Public Class Methods
new(data, machine_generator=nil)
click to toggle source
Calls superclass method
Topo::Provision::ResourceGenerator::new
# File lib/topo/provision/generators/node_group.rb, line 33 def initialize(data, machine_generator=nil) @resource_type ||= "machine_batch" super(data) @template_base_name = "node_group" machine_data = data.clone @size = value_from_path(data, %w[provisioning node_group size]) # append a number to the name if size is specified if !@size.nil? machine_data['name'] = "#{data['name']}\#{i}" end @size ||= 1 @machine_generator = machine_generator || Topo::Provision::MachineGenerator.new(machine_data) end
Public Instance Methods
batch_action(action)
click to toggle source
# File lib/topo/provision/generators/node_group.rb, line 64 def batch_action(action) machine_names = [] 1.upto @size do |i| machine_names << "#{name}#{i}" end puts(template("action").result(binding)) end
deploy()
click to toggle source
# File lib/topo/provision/generators/node_group.rb, line 47 def deploy() # temporarily divert stdout & perform machine action machine_output = divert_stdout do @machine_generator.deploy end # put into batch puts(template("deploy").result(binding)) end
stop()
click to toggle source
# File lib/topo/provision/generators/node_group.rb, line 60 def stop() batch_action(:stop) end
undeploy()
click to toggle source
# File lib/topo/provision/generators/node_group.rb, line 56 def undeploy() batch_action(:destroy) end