Sha256: 60e9b3f508d4140e0bc7f26d611240282bd0ce33fc409b0e0175ea0849b48877

Contents?: true

Size: 1.39 KB

Versions: 6

Compression:

Stored size: 1.39 KB

Contents

require 'beaker-hostgenerator/generator'
require 'beaker-hostgenerator/data/vmpooler'
require 'beaker-hostgenerator/data'
require 'deep_merge'

module BeakerHostGenerator
  class Vmpooler < BeakerHostGenerator::Generator
    include BeakerHostGenerator::Data
    include BeakerHostGenerator::Data::Vmpooler

    def initialize(options)
      @config = {}
      @config.deep_merge! BASE_CONFIG
      @config.deep_merge! VMPOOLER_CONFIG
      super(options)
    end

    def generate_node node_info, base_config, bhg_version=0
      host_config = {}
      host_config.deep_merge! base_config

      # set hypervisor
      host_config['hypervisor'] = 'vmpooler'

      # generate node definition
      ostype = node_info['ostype']
      nodeid = node_info['nodeid']
      bits = node_info['bits']

      platform = "#{ostype}-#{bits}"
      name = "#{platform}-#{nodeid}"

      osinfo = get_osinfo(bhg_version)
      host_config.deep_merge! osinfo[platform]

      # Some vmpooler/vsphere platforms have special requirements. We munge the
      # node host_config here if that is necessary.
      fixup_node host_config

      return name, host_config
    end

    def is_ostype_token? token, bhg_version=0
      osinfo = get_osinfo(bhg_version)
      osinfo.each do |key,value|

        ostype = key.split('-')[0]

        if ostype == token
          return true
        end

      end

      return false
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
beaker-hostgenerator-0.5.0 lib/beaker-hostgenerator/generator/vmpooler.rb
beaker-hostgenerator-0.4.0 lib/beaker-hostgenerator/generator/vmpooler.rb
beaker-hostgenerator-0.3.3 lib/beaker-hostgenerator/generator/vmpooler.rb
beaker-hostgenerator-0.3.2 lib/beaker-hostgenerator/generator/vmpooler.rb
beaker-hostgenerator-0.3.1 lib/beaker-hostgenerator/generator/vmpooler.rb
beaker-hostgenerator-0.3.0 lib/beaker-hostgenerator/generator/vmpooler.rb