Sha256: 260acf161ec72af5a55c72fbf59932e07d15c7a8f386376140a7a5856e46e160

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

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

module BeakerHostGenerator
  module Hypervisor
    class Docker < BeakerHostGenerator::Hypervisor::Interface
      include BeakerHostGenerator::Data

      def generate_node(node_info, base_config, bhg_version)
        base_config['docker_cmd'] = ['/sbin/init']
        base_config['image'] = node_info['ostype'].sub(/(\d)/, ':\1')
        case node_info['ostype']
        when /^oracle/
          base_config['image'].sub!(/\w+/, 'oraclelinux')
        when /^opensuse/
          base_config['image'].sub!(/(\w+)/, '\1/leap')
        when /^ubuntu/
          base_config['image'].sub!(/(\d{2})/, '\1.')
        when /^rocky/
          base_config['image'].sub!(/(\w+)/, 'rockylinux')
        when /^alma/
          base_config['image'].sub!(/(\w+)/, 'almalinux')
        end

        base_config['image'] = "amd64/#{base_config['image']}" if node_info['bits'] == '64'

        case node_info['ostype']
        when /^ubuntu/
          base_config['docker_image_commands'] = [
            'cp /bin/true /sbin/agetty',
            'apt-get install -y net-tools wget locales iproute2 gnupg',
            'locale-gen en_US.UTF-8',
            'echo LANG=en_US.UTF-8 > /etc/default/locale',
          ]
        end

        base_generate_node(node_info, base_config, bhg_version, :docker)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beaker-hostgenerator-2.2.0 lib/beaker-hostgenerator/hypervisor/docker.rb