Sha256: 14babf8628fbf8e813eeed77fa1b56aa14228d7fb81ebbb8ec0f6a39d8da0fa1

Contents?: true

Size: 1.14 KB

Versions: 61

Compression:

Stored size: 1.14 KB

Contents

require 'beaker-hostgenerator/data'
require 'beaker-hostgenerator/roles'
require 'beaker-hostgenerator/hypervisor/vmpooler'
require 'deep_merge'

module BeakerHostGenerator
  module Utils
    module_function

    def pe_dir(version, family = nil)
      BeakerHostGenerator::Data.pe_dir(version)
    end

    def fixup_node(cfg)
      BeakerHostGenerator::Data.fixup_node(cfg)
    end

    def dump_hosts(hosts, path)
      vmpooler_hypervisor = BeakerHostGenerator::Hypervisor::Vmpooler.new
      config = {}
      config.deep_merge! BeakerHostGenerator::Data.BASE_CONFIG
      config['CONFIG'].deep_merge! vmpooler_hypervisor.global_config()

      hosts.each do |host|
        config['HOSTS'][host.node_name] = {
          'roles' => host['roles'],
          'hypervisor' => "#{host['hypervisor']}",
          'platform' => "#{host['platform']}",
        }
      end

      File.open(path, 'w') do |file|
        file.write(config.to_yaml)
      end
    end

    def get_platforms(hypervisor_type='vmpooler', bhg_version=0)
      BeakerHostGenerator::Data.get_platforms(bhg_version)
    end

    def get_roles
      BeakerHostGenerator::Roles.ROLES
    end
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
beaker-hostgenerator-1.4.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.3.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.2.10 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.2.9 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.2.8 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.2.7 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.2.6 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.2.5 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.2.4 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.2.3 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.2.2 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.2.1 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.2.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.1.44 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.1.43 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.1.42 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.1.41 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.1.40 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.1.39 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.1.38 lib/beaker-hostgenerator/util.rb