Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Quick and dirty fix for earlier DescribeSnapshotParser bug

0 views
Skip to first unread message

Erich Smith

unread,
Apr 27, 2011, 12:41:45 AM4/27/11
to ruby-aws
This appears to work, although I have not tested it extensively:

class QEc2DescribeSnapshotsParser < AwsParser #:nodoc:

def initialize (params={})
@inside_tagset = false
@tagcount = 0
super(params)
end

def tagstart(name, attributes)
@inside_tagset = true if name == 'tagSet'
@snapshot = {} if (name == 'item' && ! @inside_tagset)
end

def tagend(name)
case name
when 'volumeId' then
@snapshot[:aws_volume_id] = @text

... removed for clarity...

when 'tagSet' then
@inside_tagset = false
when 'key' then
@tagcount += 1
@snapshot[('aws_tag_' + @tagcount.to_s + '_key').to_sym] =
@text
when 'value' then
@snapshot[('aws_tag_' + @tagcount.to_s + '_value').to_sym]
= @text
when 'item' then
@result << @snapshot unless @inside_tagset
end
end
Reply all
Reply to author
Forward
0 new messages