Sha256: 8a863d5979d09f8647b482889590b34710a1edec594f562547a567bfc0a24cd7

Contents?: true

Size: 1.4 KB

Versions: 27

Compression:

Stored size: 1.4 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; computers corresponding to partial or
    #   unrecognizable resources are labeled as bogus.
    def discover!(cluster)

      # Get fully resolved servers, and build Computers using them
      computers = Computers.new(:cluster => cluster)
      #
      providers = computers.map{|c| c.providers.values }.flatten.uniq
      Ironfan.parallel(providers) do |provider|
        Ironfan.step cluster.name, "Loading #{provider.handle}", :cyan
        provider.load cluster
      end
      #
      Ironfan.step cluster.name, "Reconciling DSL and provider information", :cyan

      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

27 entries across 27 versions & 1 rubygems

Version Path
ironfan-4.8.2 lib/ironfan/broker.rb
ironfan-4.8.1 lib/ironfan/broker.rb
ironfan-4.8.0 lib/ironfan/broker.rb
ironfan-4.7.7 lib/ironfan/broker.rb
ironfan-4.7.6 lib/ironfan/broker.rb
ironfan-4.7.5 lib/ironfan/broker.rb
ironfan-4.7.3 lib/ironfan/broker.rb
ironfan-4.7.2 lib/ironfan/broker.rb
ironfan-4.7.1 lib/ironfan/broker.rb
ironfan-4.7.0 lib/ironfan/broker.rb
ironfan-4.6.2 lib/ironfan/broker.rb
ironfan-4.6.1 lib/ironfan/broker.rb
ironfan-4.6.0 lib/ironfan/broker.rb
ironfan-4.5.2 lib/ironfan/broker.rb
ironfan-4.5.1 lib/ironfan/broker.rb
ironfan-4.5.0 lib/ironfan/broker.rb
ironfan-4.4.3 lib/ironfan/broker.rb
ironfan-4.4.2 lib/ironfan/broker.rb
ironfan-4.4.1 lib/ironfan/broker.rb
ironfan-4.4.0 lib/ironfan/broker.rb