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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# 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 /^aix$/ Beaker::Aixer when /^solaris$/ Beaker::Solaris when /^vsphere$/ Beaker::Vsphere when /^fusion$/ Beaker::Fusion when /^ec2$/ Beaker::AwsSdk when /^vmpooler$/ Beaker::Vmpooler when /^vcloud$/ if ['pooling_api'] Beaker::Vmpooler else Beaker::Vcloud end when /^vagrant$/ Beaker::Vagrant when /^vagrant_custom$/ Beaker::VagrantCustom when /^vagrant_libvirt$/ Beaker::VagrantLibvirt when /^vagrant_virtualbox$/ Beaker::VagrantVirtualbox when /^vagrant_fusion$/ Beaker::VagrantFusion when /^vagrant_workstation$/ Beaker::VagrantWorkstation when /^vagrant_parallels$/ Beaker::VagrantParallels when /^google$/ Beaker::GoogleCompute when /^docker$/ Beaker::Docker when /^openstack$/ Beaker::OpenStack when /^noop$/ Beaker::Noop when /^(default)|(none)$/ Beaker::Hypervisor else # Custom hypervisor begin require "beaker/hypervisor/#{type}" rescue LoadError raise "Invalid hypervisor: #{type}" end Beaker.const_get(type.capitalize) end hypervisor = hyper_class.new(hosts_to_provision, ) hypervisor.provision hypervisor end |