Sha256: 6a030cf2cfbc4c79ddec54c01c2ea72459db117bd6b9a05050cf431d7de735a2

Contents?: true

Size: 1.16 KB

Versions: 18

Compression:

Stored size: 1.16 KB

Contents

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

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.deeper_merge! BeakerHostGenerator::Data.BASE_CONFIG
      config['CONFIG'].deeper_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

18 entries across 18 versions & 1 rubygems

Version Path
beaker-hostgenerator-1.18.1 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.18.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.17.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.16.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.15.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.14.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.13.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.12.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.11.1 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.11.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.10.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.9.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.8.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.7.1 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.7.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.6.1 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.6.0 lib/beaker-hostgenerator/util.rb
beaker-hostgenerator-1.5.0 lib/beaker-hostgenerator/util.rb