Sha256: c02a36880747ae656c6f01638ed11629b5cd010d43c22581c621d8c681ddba0d

Contents?: true

Size: 1.99 KB

Versions: 3

Compression:

Stored size: 1.99 KB

Contents

require 'beaker-hostgenerator/data'
require 'beaker-hostgenerator/hypervisor'
require 'deep_merge/rails_compat'

module BeakerHostGenerator
  module Hypervisor
    # AlwaysBeScheduling implementation to support CI.next.
    #
    # The ABS services requires the vmpooler template values as input to
    # determine the type of platform that's being requested.
    #
    # Therefore, this hypervisor just reuses the vmpooler hypervisor template
    # values, in addition to ABS-only values for hardware platforms.
    class ABS < BeakerHostGenerator::Hypervisor::Interface
      include BeakerHostGenerator::Data

      def generate_node(node_info, base_config, bhg_version)
        # Grab vmpooler data for this platform and any hardware (ABS) data.
        # The assumption here is that these are mutually exclusive; that is,
        # any given platform will have *either* :vmpooler data or :abs data
        # so we're not worried about one overriding the other when we merge
        # the hashes together.
        base_config = base_generate_node(node_info, base_config, bhg_version, :vmpooler, :abs)

        case node_info['ostype']
        when /^centos/
          base_config['template'] = base_config['platform'].gsub(/^el/, 'centos')
        when /^fedora/
          base_config['template'] = base_config['platform']
        when /^ubuntu/
          base_template = node_info['ostype'].sub('ubuntu', 'ubuntu-')
          arch = case node_info['bits']
                 when '64'
                   'x86_64'
                 when '32'
                   'i386'
                 when 'AARCH64'
                   'arm64'
                 when 'POWER'
                   base_template = node_info['ostype'].sub(/ubuntu(\d\d)/, 'ubuntu-\1.')
                   'power8'
                 else
                   raise "Unknown bits '#{node_info['bits']}' for '#{node_info['ostype']}'"
                 end
          base_config['template'] = "#{base_template}-#{arch}"
        end

        base_config
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
beaker-hostgenerator-1.7.0 lib/beaker-hostgenerator/hypervisor/abs.rb
beaker-hostgenerator-1.6.1 lib/beaker-hostgenerator/hypervisor/abs.rb
beaker-hostgenerator-1.6.0 lib/beaker-hostgenerator/hypervisor/abs.rb