From 976e4bdcf1c77d348361de53bde511c75580a092 Mon Sep 17 00:00:00 2001 From: geemus Date: Mon, 10 May 2010 15:01:19 -0700 Subject: [PATCH] [ec2] fix a race condition around address model instantiation --- lib/fog/aws/models/ec2/address.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/fog/aws/models/ec2/address.rb b/lib/fog/aws/models/ec2/address.rb index 34502e1487..6150443f7c 100644 --- a/lib/fog/aws/models/ec2/address.rb +++ b/lib/fog/aws/models/ec2/address.rb @@ -10,6 +10,12 @@ class Address < Fog::Model attribute :server_id, 'instanceId' + def initialize(attributes = {}) + # assign server first to prevent race condition with new_record? + self.server = attributes.delete(:server) + super + end + def destroy requires :public_ip