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:
parent
d23a021594
commit
ebe02b874d
2 changed files with 18 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
unless @in_product_codes
|
||||
@response[:image_set] << @image
|
||||
@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'
|
||||
|
|
Loading…
Reference in a new issue