From 7b0c0a372995d0519e72328d377a9ee5d1f3d10f Mon Sep 17 00:00:00 2001 From: Frederick Cheung Date: Sun, 11 Jan 2015 20:47:08 +0000 Subject: [PATCH] fix classic link mocks --- lib/fog/aws/requests/compute/describe_classic_link_instances.rb | 2 +- lib/fog/aws/requests/compute/detach_classic_link_vpc.rb | 2 +- lib/fog/aws/requests/compute/stop_instances.rb | 2 +- lib/fog/aws/requests/compute/terminate_instances.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/fog/aws/requests/compute/describe_classic_link_instances.rb b/lib/fog/aws/requests/compute/describe_classic_link_instances.rb index a2890f218..14a912304 100644 --- a/lib/fog/aws/requests/compute/describe_classic_link_instances.rb +++ b/lib/fog/aws/requests/compute/describe_classic_link_instances.rb @@ -40,7 +40,7 @@ module Fog class Mock def describe_classic_link_instances(options={}) response = Excon::Response.new - instances = self.data[:instances].select {|instance| instance['classicLinkVpcId']} + instances = self.data[:instances].values.select {|instance| instance['classicLinkVpcId']} if options[:filters] instances = apply_tag_filters(instances, options[:filters], 'instanceId') instances = instances.select {|instance| instance['classicLinkVpcId'] == options[:filters]['vpc-id']} if options[:filters]['vpc-id'] diff --git a/lib/fog/aws/requests/compute/detach_classic_link_vpc.rb b/lib/fog/aws/requests/compute/detach_classic_link_vpc.rb index 1b780b7e8..9c57c01eb 100644 --- a/lib/fog/aws/requests/compute/detach_classic_link_vpc.rb +++ b/lib/fog/aws/requests/compute/detach_classic_link_vpc.rb @@ -44,7 +44,7 @@ module Fog } unless dry_run instance['classicLinkSecurityGroups'] = nil - instance['classicLinkVpc'] = nil + instance['classicLinkVpcId'] = nil end response elsif !instance diff --git a/lib/fog/aws/requests/compute/stop_instances.rb b/lib/fog/aws/requests/compute/stop_instances.rb index dfed38735..bb49a53d4 100644 --- a/lib/fog/aws/requests/compute/stop_instances.rb +++ b/lib/fog/aws/requests/compute/stop_instances.rb @@ -44,7 +44,7 @@ module Fog response.body = { 'instancesSet' => instance_set.reduce([]) do |ia, instance| instance['classicLinkSecurityGroups'] = nil - instance['classicLinkVpc'] = nil + instance['classicLinkVpcId'] = nil ia << {'currentState' => { 'code' => 0, 'name' => 'stopping' }, 'previousState' => instance['instanceState'], 'instanceId' => instance['instanceId'] } diff --git a/lib/fog/aws/requests/compute/terminate_instances.rb b/lib/fog/aws/requests/compute/terminate_instances.rb index 11478a8e6..98cbf50de 100644 --- a/lib/fog/aws/requests/compute/terminate_instances.rb +++ b/lib/fog/aws/requests/compute/terminate_instances.rb @@ -46,7 +46,7 @@ module Fog for id in instance_id instance = self.data[:instances][id] instance['classicLinkSecurityGroups'] = nil - instance['classicLinkVpc'] = nil + instance['classicLinkVpcId'] = nil self.data[:deleted_at][id] = Time.now code = case instance['instanceState']['name'] when 'pending'