From 413cc519649469839b4b483ef8d8ea44d9e0383a Mon Sep 17 00:00:00 2001 From: Wesley Beary Date: Fri, 23 Oct 2009 09:30:53 -0700 Subject: [PATCH] fix volume reload, and set availability zone to match when assigning instance --- lib/fog/aws/models/ec2/volume.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/fog/aws/models/ec2/volume.rb b/lib/fog/aws/models/ec2/volume.rb index b458a9cfc..031757af1 100644 --- a/lib/fog/aws/models/ec2/volume.rb +++ b/lib/fog/aws/models/ec2/volume.rb @@ -29,6 +29,9 @@ module Fog def instance=(new_instance) if !@volume_id @instance = new_instance + if new_instance + @availability_zone = new_instance.availability_zone + end elsif new_instance @instance = nil @instance_id = new_instance.instance_id @@ -37,8 +40,9 @@ module Fog end def reload - new_attributes = volumes.get(@volume_id).attributes - merge_attributes(new_attributes) + if new_volume = volumes.get(@volume_id) + merge_attributes(new_volume.attributes) + end end def save