Method: Beaker::Hypervisor.create
- Defined in:
- lib/beaker/hypervisor.rb
.create(type, hosts_to_provision, options) ⇒ Object
Hypervisor creator method. Creates the appropriate hypervisor class object based upon the provided hypervisor type selected, then provisions hosts with hypervisor.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/beaker/hypervisor.rb', line 20 def self.create(type, hosts_to_provision, ) @logger = [:logger] @logger.notify("Beaker::Hypervisor, found some #{type} boxes to create") hyper_class = case type when /^noop$/ Beaker::Noop when /^(default)|(none)$/ Beaker::Hypervisor else # Custom hypervisor require "beaker/hypervisor/#{type}" Beaker.const_get(type.split('_').collect(&:capitalize).join) end hypervisor = hyper_class.new(hosts_to_provision, ) self.set_ssh_connection_preference(hosts_to_provision, hypervisor) hypervisor.provision if [:provision] hypervisor end |