class PackerFiles::Virtual::Hypervisors

Top level class for managing hypervisors in a OS Spec file

Public Class Methods

doc_file() click to toggle source

Documentation for this class

# File lib/PackerFiles/Virtual/Hypervisors.rb, line 33
def self.doc_file
   PackerFiles.DirPath('Virtual/example/Hypervisors.txt').first
end
new() { |self| ... } click to toggle source

Constructor just yields self for further initialization

# File lib/PackerFiles/Virtual/Hypervisors.rb, line 43
def initialize(&block)
   yield self if block_given?   
end

Public Instance Methods

convert(gen, builder) click to toggle source

Given a generator and a OS class derived from builder, convert it into hashes suitable for packer json file generation

# File lib/PackerFiles/Virtual/Hypervisors.rb, line 49
def convert(gen, builder)

  # Convert parameters into hash for registered Hypervisors
  if !self.VirtualBox.nil?
     hash = builder.vbox_converter_hook(gen)
     gen.builders.push(hash) if !hash.nil?
  end
  if !self.VMWare.nil?
     hash = builder.vmware_converter_hook(gen)
     gen.builders.push(hash) if !hash.nil?
  end
  if !self.KVM.nil?
     hash = builder.kvm_converter_hook(gen)
     gen.builders.push(hash) if !hash.nil?
  end

end