Method: Bfire::Group#initialize
- Defined in:
- lib/bfire/group.rb
#initialize(engine, name, options = {}) ⇒ Group
Returns a new instance of Group.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bfire/group.rb', line 16 def initialize(engine, name, = {}) @engine = engine @name = name @tag = .delete(:tag) raise Error, "Tag name can't contain two or more consecutive dashes" if @tag && @tag =~ /-{2,}/ = @listeners = {} @dependencies = [] @templates = [] @default_template = Template.new(self, :default) @current_template = @default_template raise Error, "Group name can only contain [a-zA-Z0-9] characters" if name !~ /[a-z0-9]+/i on(:error) {|group| Thread.current.group.list.each{|t| t[:ko] = true t.kill } } on(:ready) {|group| group.engine.logger.info "#{group.banner}All VMs are now READY: #{computes.map{|vm| [vm['name'], (vm['nic'] || []).map{|n| n['ip']}.inspect].join("=") }.join("; ")}" } end |