Class: PackerFiles::Virtual::Hypervisors

Inherits:
Utils::TypeAccessor show all
Defined in:
lib/PackerFiles/Virtual/Hypervisors.rb

Overview

Top level class for managing hypervisors in a OS Spec file

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Utils::TypeAccessor

proc_from, type_accessor, type_accessors

Constructor Details

#initialize {|_self| ... } ⇒ Hypervisors

Constructor just yields self for further initialization

Yields:

  • (_self)

Yield Parameters:



43
44
45
# File 'lib/PackerFiles/Virtual/Hypervisors.rb', line 43

def initialize(&block)
   yield self if block_given?   
end

Class Method Details

.doc_fileObject

Documentation for this class



33
34
35
# File 'lib/PackerFiles/Virtual/Hypervisors.rb', line 33

def self.doc_file
   PackerFiles.DirPath('Virtual/example/Hypervisors.txt').first
end

Instance Method Details

#convert(gen, builder) ⇒ Object

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



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# 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