Method: Beaker::OpenStack#initialize
- Defined in:
- lib/beaker/hypervisor/openstack.rb
#initialize(openstack_hosts, options) ⇒ OpenStack
Create a new instance of the OpenStack hypervisor object
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 |
# File 'lib/beaker/hypervisor/openstack.rb', line 23 def initialize(openstack_hosts, ) require 'fog' = @logger = [:logger] @hosts = openstack_hosts @vms = [] raise 'You must specify an Openstack API key (:oopenstack_api_key) for OpenStack instances!' unless [:openstack_api_key] raise 'You must specify an Openstack username (:openstack_username) for OpenStack instances!' unless [:openstack_username] raise 'You must specify an Openstack auth URL (:openstack_auth_url) for OpenStack instances!' unless [:openstack_auth_url] raise 'You must specify an Openstack tenant (:openstack_tenant) for OpenStack instances!' unless [:openstack_tenant] raise 'You must specify an Openstack network (:openstack_network) for OpenStack instances!' unless [:openstack_network] @compute_client ||= Fog::Compute.new(:provider => :openstack, :openstack_api_key => [:openstack_api_key], :openstack_username => [:openstack_username], :openstack_auth_url => [:openstack_auth_url], :openstack_tenant => [:openstack_tenant]) if not @compute_client raise "Unable to create OpenStack Compute instance (api key: #{@options[:openstack_api_key]}, username: #{@options[:openstack_username]}, auth_url: #{@options[:openstack_auth_url]}, tenant: #{@options[:openstack_tenant]})" end @network_client ||= Fog::Network.new( :provider => :openstack, :openstack_api_key => [:openstack_api_key], :openstack_username => [:openstack_username], :openstack_auth_url => [:openstack_auth_url]) if not @network_client raise "Unable to create OpenStack Network instance (api_key: #{@options[:openstack_api_key]}, username: #{@options[:openstack_username]}, auth_url: #{@options[:openstack_auth_url]}, tenant: #{@options[:openstack_tenant]})" end end |