Method: Maestro::Node::Base#initialize

Defined in:
lib/maestro/node.rb

#initialize(name, cloud, &block) ⇒ Base

Creates a new Node

Raises:

  • (StandardError)


27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/maestro/node.rb', line 27

def initialize(name, cloud, &block)
  super()
  raise StandardError, "Node name cannot contain spaces: #{name}" if name.is_a?(String) && !name.index(/\s/).nil?
  @name = name
  @cloud = cloud
  @logger = Log4r::Logger.new(Regexp::quote(@name.to_s))
  outputter = Log4r::StdoutOutputter.new("#{@name.to_s}-stdout")
  outputter.formatter = ConsoleFormatter.new
  @logger.add(outputter)
  init_logs
  instance_eval(&block) if block_given?
end