mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Rescue opennebula
loading issues
`require "opennebula"` fails when downstream tries to require `xmlrpc` which is not included within the main `fog` dependencies. The problem is that the `LoadError` was being trapped by `Fog::SevicesMixin#new` so it was reporting that the OpenNebula provider did not offer the service. This then handles the `Fog::Errors::LoadError` in all the shindo tests that halted the run. These tests will be pending unless `opennebula` is installed.
This commit is contained in:
parent
4fb6da70e1
commit
a759f97388
11 changed files with 56 additions and 17 deletions
|
@ -98,7 +98,12 @@ module Fog
|
|||
@opennebula_endpoint = options[:opennebula_endpoint]
|
||||
@opennebula_username = options[:opennebula_username]
|
||||
@opennebula_password = options[:opennebula_password]
|
||||
require 'opennebula'
|
||||
|
||||
begin
|
||||
require "opennebula"
|
||||
rescue LoadError
|
||||
raise Fog::Errors::LoadError, "To use OpenNebula provider, you must load 'opennebula' gem"
|
||||
end
|
||||
end
|
||||
|
||||
def client
|
||||
|
|
|
@ -20,7 +20,11 @@
|
|||
|
||||
require 'rubygems'
|
||||
require 'json'
|
||||
require 'opennebula'
|
||||
begin
|
||||
require "opennebula"
|
||||
rescue LoadError
|
||||
raise Fog::Errors::LoadError, "To use OpenNebula provider, you must load 'opennebula' gem"
|
||||
end
|
||||
|
||||
|
||||
#if !ONE_LOCATION
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
Shindo.tests('Fog::Compute[:opennebula]', ['opennebula']) do
|
||||
|
||||
compute = Fog::Compute[:opennebula]
|
||||
begin
|
||||
compute = Fog::Compute[:opennebula]
|
||||
rescue Fog::Errors::LoadError
|
||||
pending
|
||||
end
|
||||
|
||||
tests("Compute collections") do
|
||||
%w{networks groups}.each do |collection|
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
Shindo.tests('Fog::Compute[:opennebula] | flavor model', ['opennebula']) do
|
||||
begin
|
||||
flavors = Fog::Compute[:opennebula].flavors
|
||||
rescue Fog::Errors::LoadError
|
||||
pending
|
||||
end
|
||||
|
||||
flavors = Fog::Compute[:opennebula].flavors
|
||||
flavor = flavors.get_by_name('fogtest').last
|
||||
|
||||
tests('The flavor model should') do
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
Shindo.tests('Fog::Compute[:opennebula] | flavors collection', ['opennebula']) do
|
||||
|
||||
flavors = Fog::Compute[:opennebula].flavors
|
||||
begin
|
||||
flavors = Fog::Compute[:opennebula].flavors
|
||||
rescue Fog::Errors::LoadError
|
||||
pending
|
||||
end
|
||||
|
||||
tests('The flavors collection should') do
|
||||
test('should be a kind of Fog::Compute::OpenNebula::Flavors') { flavors.kind_of? Fog::Compute::OpenNebula::Flavors }
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
Shindo.tests('Fog::Compute[:opennebula] | group model', ['opennebula']) do
|
||||
|
||||
groups = Fog::Compute[:opennebula].groups
|
||||
begin
|
||||
groups = Fog::Compute[:opennebula].groups
|
||||
rescue Fog::Errors::LoadError
|
||||
pending
|
||||
end
|
||||
group = groups.last
|
||||
|
||||
tests('The group model should') do
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
Shindo.tests('Fog::Compute[:opennebula] | groups collection', ['opennebula']) do
|
||||
|
||||
groups = Fog::Compute[:opennebula].groups
|
||||
begin
|
||||
groups = Fog::Compute[:opennebula].groups
|
||||
rescue Fog::Errors::LoadError
|
||||
pending
|
||||
end
|
||||
|
||||
tests('The groups collection') do
|
||||
test('should be a kind of Fog::Compute::OpenNebula::Groups') { groups.kind_of? Fog::Compute::OpenNebula::Groups }
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
Shindo.tests('Fog::Compute[:opennebula] | network model', ['opennebula']) do
|
||||
begin
|
||||
networks = Fog::Compute[:opennebula].networks
|
||||
rescue Fog::Errors::LoadError
|
||||
pending
|
||||
end
|
||||
|
||||
networks = Fog::Compute[:opennebula].networks
|
||||
network = networks.get_by_name('fogtest')
|
||||
|
||||
tests('The network model should') do
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
Shindo.tests('Fog::Compute[:opennebula] | networks collection', ['opennebula']) do
|
||||
|
||||
networks = Fog::Compute[:opennebula].networks
|
||||
begin
|
||||
networks = Fog::Compute[:opennebula].networks
|
||||
rescue Fog::Errors::LoadError
|
||||
pending
|
||||
end
|
||||
|
||||
tests('The networks collection') do
|
||||
test('should be a kind of Fog::Compute::OpenNebula::Networks') { networks.kind_of? Fog::Compute::OpenNebula::Networks }
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
Shindo.tests("Fog::Compute[:opennebula] | vm_create and vm_destroy request", 'opennebula') do
|
||||
begin
|
||||
compute = Fog::Compute[:opennebula]
|
||||
rescue Fog::Errors::LoadError
|
||||
pending
|
||||
end
|
||||
|
||||
compute = Fog::Compute[:opennebula]
|
||||
name_base = Time.now.to_i
|
||||
f = compute.flavors.get_by_name("fogtest")
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
Shindo.tests("Fog::Compute[:opennebula] | vm_suspend and vm_resume request", 'opennebula') do
|
||||
|
||||
compute = Fog::Compute[:opennebula]
|
||||
begin
|
||||
compute = Fog::Compute[:opennebula]
|
||||
rescue Fog::Errors::LoadError
|
||||
pending
|
||||
end
|
||||
|
||||
name_base = Time.now.to_i
|
||||
f = compute.flavors.get_by_name("fogtest")
|
||||
|
|
Loading…
Add table
Reference in a new issue