1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

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.
This commit is contained in:
E.J. Finneran 2011-08-30 14:39:21 -05:00
parent a0d3fe9dd2
commit 2dd7c1aeaf

View file

@ -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))