Class: Vmreverter::Hypervisor

Inherits:
Object
  • Object
show all
Defined in:
lib/vmreverter/hypervisor.rb

Overview

Factory Pattern - Class to generate the correct hypervisor object, given type

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.register(type, hosts_to_provision, config) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/vmreverter/hypervisor.rb', line 13

def self.register(type, hosts_to_provision, config)
  @logger = config.logger
  @logger.notify("Hypervisor found some #{type} boxes to hook")
  case type.downcase
    when /vsphere/
      return Vmreverter::Vsphere.new(hosts_to_provision, config)
    when /aws/
      return Vmreverter::AWS.new(hosts_to_provision, config)
    else
      report_and_raise(@logger, RuntimeError.new("Missing Class for hypervisor invocation: (#{type})"), "Hypervisor::register")
  end
end

Instance Method Details

#configure(hosts) ⇒ Object



9
10
11
# File 'lib/vmreverter/hypervisor.rb', line 9

def configure(hosts)
  @logger.debug "No post-provisioning configuration necessary for #{self.class.name} boxes"
end