Skip to content

Commit

Permalink
rescue/retry when loading gems (possibly without rubygems)
Browse files Browse the repository at this point in the history
closes fog#901
  • Loading branch information
geemus committed Dec 28, 2012
1 parent 5e8c950 commit 62e1c09
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/fog/libvirt/compute.rb
Expand Up @@ -82,7 +82,12 @@ def initialize(options={})
@ip_command = options[:libvirt_ip_command] @ip_command = options[:libvirt_ip_command]


# libvirt is part of the gem => ruby-libvirt # libvirt is part of the gem => ruby-libvirt
require 'libvirt' begin
require 'libvirt'
rescue LoadError => e
retry if require('rubygems')
raise e.message
end


begin begin
if options[:libvirt_username] and options[:libvirt_password] if options[:libvirt_username] and options[:libvirt_password]
Expand Down
8 changes: 7 additions & 1 deletion lib/fog/virtual_box/compute.rb
Expand Up @@ -30,7 +30,13 @@ def initialize(options={})
class Real class Real


def initialize(options={}) def initialize(options={})
require 'virtualbox' begin
require 'virtualbox'
rescue LoadError => e
retry if require('rubygems')
raise e.message
end

@connection = ::VirtualBox::Global.global.lib.virtualbox @connection = ::VirtualBox::Global.global.lib.virtualbox
end end


Expand Down
7 changes: 6 additions & 1 deletion lib/fog/vmfusion/compute.rb
Expand Up @@ -20,7 +20,12 @@ def initialize(options={})
class Real class Real


def initialize(options={}) def initialize(options={})
require 'fission' begin
require 'fission'
rescue LoadError => e
retry if require('rubygems')
raise e.message
end
end end


end end
Expand Down

0 comments on commit 62e1c09

Please sign in to comment.