Sha256: d70a8ccbdd1ea612b1af051a9d96825796ffb7d39eeb0677746e37407504ac9f

Contents?: true

Size: 1.14 KB

Versions: 6

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

      delegate_to(providers) { 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

6 entries across 6 versions & 1 rubygems

Version Path
ironfan-4.0.5 lib/ironfan/broker.rb
ironfan-4.0.4 lib/ironfan/broker.rb
ironfan-4.0.3 lib/ironfan/broker.rb
ironfan-4.0.2 lib/ironfan/broker.rb
ironfan-4.0.1 lib/ironfan/broker.rb
ironfan-4.0.0 lib/ironfan/broker.rb