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

fix for image product_codes in parser

This commit is contained in:
Wesley Beary 2009-07-09 23:02:24 -07:00
parent d23a021594
commit ebe02b874d
2 changed files with 18 additions and 5 deletions

View file

@ -390,8 +390,6 @@ module Fog
:method => 'POST'
})
p response
if parser && !response.body.empty?
Nokogiri::XML::SAX::Parser.new(parser).parse(response.body.split(/<\?xml.*\?>/)[1])
response.body = parser.response

View file

@ -101,10 +101,17 @@ module Fog
class DescribeImages < Fog::Parsers::Base
def reset
@image = {}
@image = { :product_codes => [] }
@response = { :image_set => [] }
end
def start_element(name, attrs = [])
if name == 'productCodes'
@in_product_codes = true
end
@value = ''
end
def end_element(name)
case name
when 'architecture'
@ -126,10 +133,18 @@ module Fog
@image[:is_public] = false
end
when 'item'
@response[:image_set] << @image
@image = {}
unless @in_product_codes
@response[:image_set] << @image
@image = { :product_codes => [] }
end
when 'kernelId'
@image[:kernel_id] = @value
when 'platform'
@image[:platform] = @value
when 'productCode'
@image[:product_codes] << @value
when 'productCodes'
@in_product_codes = false
when 'ramdiskId'
@image[:ramdisk_id] = @value
when 'requestId'