From ce2c3ca8f66864c2b3b6a33e2c54b06049543d86 Mon Sep 17 00:00:00 2001 From: geemus Date: Fri, 27 May 2011 12:22:27 -0700 Subject: [PATCH] [aws|compute] mock: make address detach others before associating closes #233 --- lib/fog/compute/requests/aws/associate_address.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/fog/compute/requests/aws/associate_address.rb b/lib/fog/compute/requests/aws/associate_address.rb index e5401ac66..0e654dcfb 100644 --- a/lib/fog/compute/requests/aws/associate_address.rb +++ b/lib/fog/compute/requests/aws/associate_address.rb @@ -40,6 +40,10 @@ module Fog if instance && address address['instanceId'] = instance_id instance['originalIpAddress'] = instance['ipAddress'] + # detach other address (if any) + if self.data[:addresses][instance['originalIpAddress']] + self.data[:addresses][instance['originalIpAddress']]['instanceId'] = nil + end instance['ipAddress'] = public_ip instance['dnsName'] = Fog::AWS::Mock.dns_name_for(public_ip) response.status = 200