From 2dd7c1aeaf0db720ad6bd42ecbac19dc55818520 Mon Sep 17 00:00:00 2001 From: "E.J. Finneran" Date: Tue, 30 Aug 2011 14:39:21 -0500 Subject: [PATCH] InstanceId should have index according to AWS Docs - Even if there is only one InstanceId, the docs seem to indicate we should include an index. - OpenStack's API expects the index in all cases so this will fix compatibility there as well. --- lib/fog/aws/requests/compute/describe_instances.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/fog/aws/requests/compute/describe_instances.rb b/lib/fog/aws/requests/compute/describe_instances.rb index bea4f68b3..4d3d288cb 100644 --- a/lib/fog/aws/requests/compute/describe_instances.rb +++ b/lib/fog/aws/requests/compute/describe_instances.rb @@ -58,9 +58,12 @@ module Fog filters = {'instance-id' => [*filters]} end params = {} - # when seeking single instance id, old param style provides more accurate data sooner - if filters['instance-id'] && !filters['instance-id'].is_a?(Array) - params.merge!('InstanceId' => filters.delete('instance-id')) + if filters['instance-id'] + instance_ids = filters.delete('instance-id') + instance_ids = [instance_ids] unless instance_ids.is_a?(Array) + instance_ids.each_with_index do |id, index| + params.merge!("InstanceId.#{index}" => id) + end end params.merge!(Fog::AWS.indexed_filters(filters))