Skip to content

Commit

Permalink
[AWS|AutoScaling] Fix describe_auto_scaling_groups parser added spuri…
Browse files Browse the repository at this point in the history
…ous nil groups
  • Loading branch information
fcheung committed Sep 4, 2012
1 parent cb0bc18 commit 95965df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Expand Up @@ -15,7 +15,8 @@ def reset
end

def reset_auto_scaling_group
@auto_scaling_group = { 'AvailabilityZones' => [], 'EnabledMetrics' => [], 'Instances' => [], 'LoadBalancerNames' => [], 'SuspendedProcesses' => [] }
@auto_scaling_group = { 'AvailabilityZones' => [], 'EnabledMetrics' => [], 'Instances' => [],
'LoadBalancerNames' => [], 'SuspendedProcesses' => [], 'TerminationPolicies' => [] }
end

def reset_enabled_metric
Expand Down Expand Up @@ -43,6 +44,8 @@ def start_element(name, attrs = [])
@in_load_balancer_names = true
when 'SuspendedProcesses'
@in_suspended_processes = true
when 'TerminationPolicies'
@in_termination_policies = true
end
end

Expand All @@ -62,6 +65,8 @@ def end_element(name)
elsif @in_suspended_processes
@auto_scaling_group['SuspendedProcesses'] << @suspended_process
reset_suspended_process
elsif @in_termination_policies
@auto_scaling_group['TerminationPolicies'] << value
elsif !@in_instances && !@in_policies
@results['AutoScalingGroups'] << @auto_scaling_group
reset_auto_scaling_group
Expand All @@ -81,6 +86,8 @@ def end_element(name)
else
@auto_scaling_group[name] = value
end
when 'TerminationPolicies'
@in_termination_policies = false

when 'AvailabilityZone', 'HealthStatus', 'InstanceId', 'LifecycleState'
@instance[name] = value
Expand Down
Expand Up @@ -98,6 +98,7 @@ def create_auto_scaling_group(auto_scaling_group_name, availability_zones, launc
'MinSize' => min_size,
'PlacementGroup' => nil,
'SuspendedProcesses' => [],
'TerminationPolicies' => [],
'VPCZoneIdentifier' => nil
}.merge!(options)

Expand Down
3 changes: 2 additions & 1 deletion tests/aws/requests/auto_scaling/helper.rb
Expand Up @@ -81,7 +81,8 @@ module Formats
'MinSize' => Integer,
'PlacementGroup' => Fog::Nullable::String,
'SuspendedProcesses' => [SUSPENDED_PROCESS],
'VPCZoneIdentifier' => Fog::Nullable::String
'VPCZoneIdentifier' => Fog::Nullable::String,
'TerminationPolicies' => [String]
}

AUTO_SCALING_INSTANCE_DETAILS = INSTANCE.merge({
Expand Down

0 comments on commit 95965df

Please sign in to comment.