Sha256: b9e8929b8b7aec3914ada21ce837c4baf76a1669697bb21a237086d473563383

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

# This module is intended to read in a cluster DSL description, and broker
#   out to the various cloud providers, to control instance life-cycle and
#   handle provider-specific amenities (SecurityGroup, Volume, etc.) for 
#   them.
module Ironfan
  def self.broker
    @@broker ||= Ironfan::Broker.new
  end

  class Broker < Builder
    # Take in a Dsl::Cluster, return Computers populated with
    #   all discovered resources that correlate, plus bogus computers
    #   corresponding to 
    def discover!(cluster)
      # Get fully resolved servers, and build Computers using them
      computers = Computers.new(:cluster => cluster.resolve)
      providers = computers.map{|c| c.providers.values}.flatten.uniq

      providers.each {|p| p.load cluster }
      computers.correlate
      computers.validate
      computers
    end

    def display(computers,style)
      defined_data = computers.map {|m| m.to_display(style) }
      if defined_data.empty?
        ui.info "Nothing to report"
      else
        headings = defined_data.map{|r| r.keys}.flatten.uniq
        Formatador.display_compact_table(defined_data, headings.to_a)
      end
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ironfan-4.0.9 lib/ironfan/broker.rb
ironfan-4.0.8 lib/ironfan/broker.rb