Sha256: ec31629cf5d3c87331f89b2a71ab641691bf47ba1445214d8787164ae814035b

Contents?: true

Size: 987 Bytes

Versions: 1

Compression:

Stored size: 987 Bytes

Contents

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

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

      def generate_node(node_info, base_config, bhg_version)
        # split ostype into string and array
        # ostype is ubuntu2204, debian10, rocky9
        os, version = node_info['ostype'].split(/(\D+)/).reject!(&:empty?)
        base_config['image'] = case os
                               when 'ubuntu'
                                 "#{os}-#{version[0, 2]}.#{version[2, 2]}"
                               when 'centos'
                                 version.to_i == 7 ? "#{os}-#{version}" : "#{os}-stream-#{version}"
                               else
                                 "#{os}-#{version}"
                               end
        base_generate_node(node_info, base_config, bhg_version, :hcloud)
      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/hcloud.rb