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

[AWS|ASG] filter mocked results for describe_auto_scaling_groups

This was causing an issue for me. Because Groups#get uses this method to
fetch a single ASG, it was always returning the first ASG in the data
set, not the one that actually matched the specified ASG name.
This commit is contained in:
Blake Gentry 2013-08-06 13:40:57 -07:00
parent 4e2b7c40b5
commit de27445256

View file

@ -111,7 +111,15 @@ module Fog
def describe_auto_scaling_groups(options = {})
results = { 'AutoScalingGroups' => [] }
self.data[:auto_scaling_groups].each do |asg_name, asg_data|
asg_set = self.data[:auto_scaling_groups]
if !options["AutoScalingGroupNames"].nil?
asg_set = asg_set.reject do |asg_name, asg_data|
![*options["AutoScalingGroupNames"]].include?(asg_name)
end
end
asg_set.each do |asg_name, asg_data|
results['AutoScalingGroups'] << {
'AutoScalingGroupName' => asg_name
}.merge!(asg_data)