Sha256: 299d5cf57ba5119ecab389d27a2d0e5f587ef3e99f6a9bb1bdaf71567fa0032c

Contents?: true

Size: 947 Bytes

Versions: 1

Compression:

Stored size: 947 Bytes

Contents

require 'oscar'

class Oscar::Environment
  attr_reader :networking
  attr_reader :config

  def initialize
    @config     = Oscar::Config.new
    @nodes = []
  end

  def run!
    @networking = Oscar::Networking.new(@config.data["networking"])
    nodes       = @config.all_node_configs

    # TODO make sure that the master is provisioned before any agents.
    nodes.each do |node_attrs|
      node = Oscar::Node.new(node_attrs)
      @networking.register(node)

      @nodes << node
    end

    pe_build_options = @config.data["provisioners"].find do |hash|
      hash["name"] == "pe_build"
    end

    Vagrant::Config.run do |config|
      config.pe_build.download_root = pe_build_options["options"]["download_root"]
      config.pe_build.version       = pe_build_options["options"]["version"]
      config.pe_build.filename      = pe_build_options["options"]["filename"]
      @nodes.each { |node| node.define(config) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
oscar-0.2.0alpha4 lib/oscar/environment.rb