mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|ec2] describe_availability_zones parser handles nested <item> tags
This patch fixes the parser so there is no empty {'messageSet' => []} value. At the moment, AWS is returning a body like that is incorrectly parsed: <availabilityZoneInfo> ... <item> <zoneName>us-east-1b</zoneName> <zoneState>impaired</zoneState> <regionName>us-east-1</regionName> <messageSet> <item> <message>We have restored the ability to launch new EC2 instances in this Availability Zone. At this point, customers should be able to launch instances in any Availability Zone in the US-EAST-1 region. We are continuing to restore impaired volumes and their attached instances.</message> </item> </messageSet>
This commit is contained in:
parent
dce5e800fd
commit
f7aa05bd01
1 changed files with 13 additions and 2 deletions
|
@ -4,6 +4,13 @@ module Fog
|
||||||
module AWS
|
module AWS
|
||||||
|
|
||||||
class DescribeAvailabilityZones < Fog::Parsers::Base
|
class DescribeAvailabilityZones < Fog::Parsers::Base
|
||||||
|
def start_element(name, attrs = [])
|
||||||
|
case name
|
||||||
|
when 'messageSet'
|
||||||
|
@in_message_set = true
|
||||||
|
end
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def reset
|
def reset
|
||||||
@availability_zone = { 'messageSet' => [] }
|
@availability_zone = { 'messageSet' => [] }
|
||||||
|
@ -13,14 +20,18 @@ module Fog
|
||||||
def end_element(name)
|
def end_element(name)
|
||||||
case name
|
case name
|
||||||
when 'item'
|
when 'item'
|
||||||
@response['availabilityZoneInfo'] << @availability_zone
|
unless @in_message_set
|
||||||
@availability_zone = { 'messageSet' => [] }
|
@response['availabilityZoneInfo'] << @availability_zone
|
||||||
|
@availability_zone = { 'messageSet' => [] }
|
||||||
|
end
|
||||||
when 'message'
|
when 'message'
|
||||||
@availability_zone['messageSet'] << value
|
@availability_zone['messageSet'] << value
|
||||||
when 'regionName', 'zoneName', 'zoneState'
|
when 'regionName', 'zoneName', 'zoneState'
|
||||||
@availability_zone[name] = value
|
@availability_zone[name] = value
|
||||||
when 'requestId'
|
when 'requestId'
|
||||||
@response[name] = value
|
@response[name] = value
|
||||||
|
when 'messageSet'
|
||||||
|
@in_message_set = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue