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

Merge pull request #2050 from bgentry/asg-filter-mocked-policies

[AWS|ASG] filter mocked results for describe_auto_scaling_policies
This commit is contained in:
Dan Peterson 2013-08-08 05:24:39 -07:00
commit 2921c81e40

View file

@ -76,7 +76,21 @@ module Fog
def describe_policies(options = {})
results = { 'ScalingPolicies' => [] }
self.data[:scaling_policies].each do |asp_name, asp_data|
policy_set = self.data[:scaling_policies]
for opt_key, opt_value in options
if opt_key == "PolicyNames" && opt_value != nil && opt_value != ""
policy_set = policy_set.reject do |asp_name, asp_data|
![*options["PolicyNames"]].include?(asp_name)
end
elsif opt_key == "AutoScalingGroupName" && opt_value != nil && opt_value != ""
policy_set = policy_set.reject do |asp_name, asp_data|
options["AutoScalingGroupName"] != asp_data["AutoScalingGroupName"]
end
end
end
policy_set.each do |asp_name, asp_data|
results['ScalingPolicies'] << {
'PolicyName' => asp_name
}.merge!(asp_data)