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'
|
:method => 'POST'
|
||||||
})
|
})
|
||||||
|
|
||||||
p response
|
|
||||||
|
|
||||||
if parser && !response.body.empty?
|
if parser && !response.body.empty?
|
||||||
Nokogiri::XML::SAX::Parser.new(parser).parse(response.body.split(/<\?xml.*\?>/)[1])
|
Nokogiri::XML::SAX::Parser.new(parser).parse(response.body.split(/<\?xml.*\?>/)[1])
|
||||||
response.body = parser.response
|
response.body = parser.response
|
||||||
|
|
|
@ -101,10 +101,17 @@ module Fog
|
||||||
class DescribeImages < Fog::Parsers::Base
|
class DescribeImages < Fog::Parsers::Base
|
||||||
|
|
||||||
def reset
|
def reset
|
||||||
@image = {}
|
@image = { :product_codes => [] }
|
||||||
@response = { :image_set => [] }
|
@response = { :image_set => [] }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def start_element(name, attrs = [])
|
||||||
|
if name == 'productCodes'
|
||||||
|
@in_product_codes = true
|
||||||
|
end
|
||||||
|
@value = ''
|
||||||
|
end
|
||||||
|
|
||||||
def end_element(name)
|
def end_element(name)
|
||||||
case name
|
case name
|
||||||
when 'architecture'
|
when 'architecture'
|
||||||
|
@ -126,10 +133,18 @@ module Fog
|
||||||
@image[:is_public] = false
|
@image[:is_public] = false
|
||||||
end
|
end
|
||||||
when 'item'
|
when 'item'
|
||||||
|
unless @in_product_codes
|
||||||
@response[:image_set] << @image
|
@response[:image_set] << @image
|
||||||
@image = {}
|
@image = { :product_codes => [] }
|
||||||
|
end
|
||||||
when 'kernelId'
|
when 'kernelId'
|
||||||
@image[:kernel_id] = @value
|
@image[:kernel_id] = @value
|
||||||
|
when 'platform'
|
||||||
|
@image[:platform] = @value
|
||||||
|
when 'productCode'
|
||||||
|
@image[:product_codes] << @value
|
||||||
|
when 'productCodes'
|
||||||
|
@in_product_codes = false
|
||||||
when 'ramdiskId'
|
when 'ramdiskId'
|
||||||
@image[:ramdisk_id] = @value
|
@image[:ramdisk_id] = @value
|
||||||
when 'requestId'
|
when 'requestId'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue