Making it work again with fog 1.10

in 1.9, the original code was sufficient, but 1.10 has a massive
refactoring in the way of registering providers. Unless at least one
provider is registered, the providers hash is empty, and it causes
an exception like the following:

/var/lib/gems/1.8/gems/fog-1.10.0/lib/fog/compute.rb:39:in `new': undefined method `include?' for nil:NilClass (NoMethodError)
    from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/boxes/aws.rb:39:in `fog'
    from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/boxes/aws.rb:32:in `validate!'
    from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/fleet.rb:110:in `start'
    from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/fleet.rb:109:in `each'
    from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/fleet.rb:109:in `start'
    from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/cli.rb:73:in `start'
    from /var/lib/gems/1.8/gems/thor-0.18.0/lib/thor/command.rb:27:in `__send__'
    from /var/lib/gems/1.8/gems/thor-0.18.0/lib/thor/command.rb:27:in `run'
    from /var/lib/gems/1.8/gems/thor-0.18.0/lib/thor/invocation.rb:120:in `invoke_command'
    from /var/lib/gems/1.8/gems/thor-0.18.0/lib/thor.rb:363:in `dispatch'
    from /var/lib/gems/1.8/gems/thor-0.18.0/lib/thor/base.rb:427:in `start'
    from /home/kohsuke/ws/cloudbees/blimpy/bin/blimpy:24

By forcing the registration of a provider, it works against with fog
1.10. Looking at the source tree, this change should also work with fog
1.9.
This commit is contained in:
Kohsuke Kawaguchi 2013-03-29 15:47:07 -07:00
parent de4830fc40
commit cd1ebc211d
2 changed files with 2 additions and 0 deletions

View File

@ -1,5 +1,6 @@
require 'blimpy/box'
require 'blimpy/boxes'
require 'fog/aws'
module Blimpy::Boxes
class AWS < Blimpy::Box

View File

@ -1,5 +1,6 @@
require 'blimpy/box'
require 'blimpy/boxes'
require 'fog/openstack'
module Blimpy::Boxes
class OpenStack < Blimpy::Box