From 60a3f4585f68e2d0761762ca3ce5c4d30cac0026 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Fri, 14 Oct 2011 16:01:23 +0530 Subject: [PATCH] [Brightbox] Fix zone_id/flavour_id getter/setter for Server --- lib/fog/brightbox/models/compute/server.rb | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/fog/brightbox/models/compute/server.rb b/lib/fog/brightbox/models/compute/server.rb index 1cb8fbf65..d986da205 100644 --- a/lib/fog/brightbox/models/compute/server.rb +++ b/lib/fog/brightbox/models/compute/server.rb @@ -27,8 +27,7 @@ module Fog # Links - to be replaced attribute :account_id, :aliases => "account", :squash => "id" attribute :image_id, :aliases => "image", :squash => "id" - attribute :flavor_id, :aliases => "server_type", :squash => "id" - attribute :zone_id, :aliases => "zone", :squash => "id" + attribute :snapshots attribute :cloud_ips attribute :interfaces @@ -39,6 +38,22 @@ module Fog super end + def zone_id + attributes[:zone_id] || zone[:id] || zone['id'] + end + + def flavor_id + attributes[:flavor_id] || server_type[:id] || server_type['id'] + end + + def zone_id=(incoming_zone_id) + attributes[:zone_id] = incoming_zone_id + end + + def flavor_id=(incoming_flavour_id) + attributes[:flavor_id] = incoming_flavour_id + end + def snapshot requires :identity connection.snapshot_server(identity)