class Leibniz::KitchenLoader

Attributes

platforms[R]
suites[R]

Public Class Methods

new(specification) click to toggle source
# File lib/leibniz.rb, line 73
def initialize(specification)
  @last_octet = 11
  @platforms = specification.hashes.map do |spec|
    create_platform(spec)
  end
  @suites = specification.hashes.map do |spec|
    create_suite(spec)
  end
end

Public Instance Methods

read() click to toggle source
# File lib/leibniz.rb, line 83
def read
  {
    :driver_plugin => "vagrant",
    :platforms => platforms,
    :suites => suites
  }
end

Private Instance Methods

create_platform(spec) click to toggle source
# File lib/leibniz.rb, line 104
def create_platform(spec)
  distro = "#{spec['Operating System']}-#{spec['Version']}"
  ipaddress = "10.2.3.#{@last_octet}"
  @last_octet += 1
  platform = Hash.new
  platform[:name] = spec["Server Name"]
  platform[:driver_config] = Hash.new
  platform[:driver_config][:box] = "opscode-#{distro}"
  platform[:driver_config][:box_url] = "https://opscode-vm.s3.amazonaws.com/vagrant/opscode_#{distro}_provisionerless.box"
  platform[:driver_config][:network] = [["private_network", {:ip => ipaddress}]]
  platform[:driver_config][:require_chef_omnibus] = spec["Chef Version"] || true
  platform[:driver_config][:ipaddress] = ipaddress
  platform[:run_list] = spec["Run List"].split(",")
  platform
end
create_suite(spec) click to toggle source
# File lib/leibniz.rb, line 95
def create_suite(spec)
  suite = Hash.new
  suite[:name] = 'leibniz'
  suite[:run_list] = []
  suite[:data_bags_path] = 'test/integration/default/data_bags'
  suite
end