Gorillib::ModelCollection
# File lib/ironfan/broker/computer.rb, line 313 def aggregate group_action(:aggregate!) end
# File lib/ironfan/broker/computer.rb, line 378 def build_slice_array(slice_indexes) return [] if slice_indexes.nil? raise "Bad slice_indexes: #{slice_indexes}" if slice_indexes =~ /[^0-9\.,]/ eval("[#{slice_indexes}]").map {|idx| idx.class == Range ? idx.to_a : idx}.flatten end
Discovery
# File lib/ironfan/broker/computer.rb, line 292 def correlate values.each{|c| c.correlate } end
set up new computers for each server in the cluster definition
# File lib/ironfan/broker/computer.rb, line 345 def create_expected! self.cluster.servers.each do |server| self << Computer.new(:server => server) end unless self.cluster.nil? end
# File lib/ironfan/broker/computer.rb, line 358 def empty_copy result = self.class.new result.cluster = self.cluster unless self.cluster.nil? result end
# File lib/ironfan/broker/computer.rb, line 336 def environments map{|comp| comp.environment }.uniq end
# File lib/ironfan/broker/computer.rb, line 302 def group_action(verb) computers = self provider_keys = values.map {|c| c.chosen_providers({ :providers => :iaas })}.flatten.uniq providers = provider_keys.map { |pk| values.map { |c| c.providers[pk] } }.flatten.compact.uniq providers.each { |p| p.send(verb, computers) } end
provide a human-readable list of names
# File lib/ironfan/broker/computer.rb, line 385 def joined_names values.map(&:name).join(", ").gsub(/, ([^,]*)$/, ' and \1') end
Manipulation
# File lib/ironfan/broker/computer.rb, line 320 def kill(options={}) Ironfan.parallel(values) {|c| c.kill(options) } end
# File lib/ironfan/broker/computer.rb, line 323 def launch Ironfan.parallel(values) {|c| c.launch } end
# File lib/ironfan/broker/computer.rb, line 309 def prepare group_action(:prepare!) end
# File lib/ironfan/broker/computer.rb, line 326 def save(options={}) Ironfan.parallel(values) {|c| c.save(options) } end
Return the selection inside another Computers collection
# File lib/ironfan/broker/computer.rb, line 352 def select(&block) result = empty_copy values.select(&block).each{|m| result << m} result end
Find all selected computers, as well as any bogus computers from discovery
# File lib/ironfan/broker/computer.rb, line 365 def slice(facet_name=nil, slice_indexes=nil) return self if (facet_name.nil? and slice_indexes.nil?) result = empty_copy slice_array = build_slice_array(slice_indexes) each do |m| result << m if (m.bogus? or ( # bogus computer or ( m.server.facet_name == facet_name ) and # facet match and ( slice_array.include? m.server.index or # index match or slice_indexes.nil? ) ) ) # no indexes specified end result end
# File lib/ironfan/broker/computer.rb, line 329 def start Ironfan.parallel(values) {|c| c.start } end
# File lib/ironfan/broker/computer.rb, line 332 def stop Ironfan.parallel(values) {|c| c.stop } end
Generated with the Darkfish Rdoc Generator 2.