Sha256: 4bf95c337cea9fb74e41bd8d4e02f48a85c277ff79927374d13da80a6e94f7a3

Contents?: true

Size: 1.14 KB

Versions: 16

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)
      BeakerHostGenerator::Data.pe_dir(version, family)
    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

16 entries across 16 versions & 1 rubygems

Version Path
beaker-hostgenerator-0.10.3 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-0.10.2 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-0.10.1 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-0.10.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-0.9.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-0.8.4 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-0.8.3 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-0.8.2 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-0.8.1 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-0.8.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-0.7.4 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-0.7.3 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-0.7.2 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-0.7.1 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-0.7.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-0.6.0 lib/beaker-hostgenerator/util.rb