1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[Brightbox] Reuses connection for image selection

Fixes #1214 - Server initialisation failed unless you had a configuration
file because it tried to create a second connection directly using the
config details.

We now get access to the 'connection' that exists and use that so it is
already configured and authenticated.
This commit is contained in:
Paul Thornthwaite 2012-10-19 09:26:21 +01:00
parent a48432a3db
commit a80fa7c32a
2 changed files with 4 additions and 2 deletions

View file

@ -209,7 +209,7 @@ module Fog
def select_default_image
return @default_image_id unless @default_image_id.nil?
all_images = Fog::Compute[:brightbox].list_images
all_images = list_images
official_images = all_images.select {|img| img["official"] == true}
ubuntu_lts_images = official_images.select {|img| img["name"] =~ /Ubuntu.*LTS/}
ubuntu_lts_i686_images = ubuntu_lts_images.select {|img| img["arch"] == "i686"}

View file

@ -38,8 +38,10 @@ module Fog
attribute :server_type
def initialize(attributes={})
self.image_id ||= Fog::Compute[:brightbox].default_image
# Call super first to initialize the 'connection' object for our default image
super
# FIXME connection is actually <Fog::Compute::Brightbox::Real> not <Fog::Connection>
self.image_id ||= connection.default_image
end
def zone_id