mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge branch 'images_parsing_fix'
This commit is contained in:
commit
63ac4159d9
2 changed files with 35 additions and 34 deletions
|
@ -23,6 +23,7 @@ module Fog
|
||||||
attribute :root_device_type, :aliases => 'rootDeviceType'
|
attribute :root_device_type, :aliases => 'rootDeviceType'
|
||||||
attribute :root_device_name, :aliases => 'rootDeviceName'
|
attribute :root_device_name, :aliases => 'rootDeviceName'
|
||||||
attribute :tags, :aliases => 'tagSet'
|
attribute :tags, :aliases => 'tagSet'
|
||||||
|
attribute :name
|
||||||
|
|
||||||
def deregister(delete_snapshot = false)
|
def deregister(delete_snapshot = false)
|
||||||
connection.deregister_image(id)
|
connection.deregister_image(id)
|
||||||
|
|
|
@ -15,8 +15,6 @@ module Fog
|
||||||
def start_element(name, attrs = [])
|
def start_element(name, attrs = [])
|
||||||
super
|
super
|
||||||
case name
|
case name
|
||||||
when 'productCodes'
|
|
||||||
@in_product_codes = true
|
|
||||||
when 'blockDeviceMapping'
|
when 'blockDeviceMapping'
|
||||||
@in_block_device_mapping = true
|
@in_block_device_mapping = true
|
||||||
when 'tagSet'
|
when 'tagSet'
|
||||||
|
@ -25,45 +23,47 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def end_element(name)
|
def end_element(name)
|
||||||
case name
|
if @in_tag_set
|
||||||
when 'architecture', 'description', 'imageId', 'imageLocation', 'imageOwnerId', 'imageState', 'imageType', 'kernelId', 'platform', 'ramdiskId', 'rootDeviceType','rootDeviceName'
|
case name
|
||||||
@image[name] = @value
|
when 'item'
|
||||||
when 'blockDeviceMapping'
|
@image['tagSet'][@tag['key']] = @tag['value']
|
||||||
@in_block_device_mapping = false
|
@tag = {}
|
||||||
when 'deviceName', 'virtualName', 'snapshotId', 'deleteOnTermination'
|
when 'key', 'value'
|
||||||
@block_device_mapping[name] = @value
|
@tag[name] = @value
|
||||||
when 'isPublic'
|
when 'tagSet'
|
||||||
if @value == 'true'
|
@in_tag_set = false
|
||||||
@image[name] = true
|
|
||||||
else
|
|
||||||
@image[name] = false
|
|
||||||
end
|
end
|
||||||
when 'item'
|
elsif @in_block_device_mapping
|
||||||
if @in_block_device_mapping
|
case name
|
||||||
@image['blockDeviceMapping'] << @block_device_mapping
|
when 'blockDeviceMapping'
|
||||||
@block_device_mapping = {}
|
@in_block_device_mapping = false
|
||||||
elsif @in_tag_set
|
when 'deviceName', 'virtualName', 'snapshotId', 'deleteOnTermination'
|
||||||
@image['tagSet'][@tag['key']] = @tag['value']
|
@block_device_mapping[name] = @value
|
||||||
@tag = {}
|
when 'volumeSize'
|
||||||
elsif !@in_product_codes
|
@block_device_mapping[name] = @value.to_i
|
||||||
|
when 'item'
|
||||||
|
@image['blockDeviceMapping'] << @block_device_mapping
|
||||||
|
@block_device_mapping = {}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
case name
|
||||||
|
when 'name','requestId','architecture', 'description', 'imageId', 'imageLocation', 'imageOwnerId', 'imageState', 'imageType', 'kernelId', 'platform', 'ramdiskId', 'rootDeviceType','rootDeviceName','virtualizationType'
|
||||||
|
@image[name] = @value
|
||||||
|
when 'isPublic'
|
||||||
|
if @value == 'true'
|
||||||
|
@image[name] = true
|
||||||
|
else
|
||||||
|
@image[name] = false
|
||||||
|
end
|
||||||
|
when 'item'
|
||||||
@response['imagesSet'] << @image
|
@response['imagesSet'] << @image
|
||||||
@image = { 'blockDeviceMapping' => [], 'productCodes' => [], 'tagSet' => {} }
|
@image = { 'blockDeviceMapping' => [], 'productCodes' => [], 'tagSet' => {} }
|
||||||
|
when 'productCode'
|
||||||
|
@image['productCodes'] << @value
|
||||||
end
|
end
|
||||||
when 'key', 'value'
|
|
||||||
@tag[name] = @value
|
|
||||||
when 'productCode'
|
|
||||||
@image['productCodes'] << @value
|
|
||||||
when 'productCodes'
|
|
||||||
@in_product_codes = false
|
|
||||||
when 'requestId'
|
|
||||||
@response[name] = @value
|
|
||||||
when 'volumeSize'
|
|
||||||
@block_device_mapping[name] = @value.to_i
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue