Project

General

Profile

« Previous | Next » 

Revision f234746f

Added by Marc Dequènes over 13 years ago

  • ID f234746f085164f502ba329ea5dbab17f5c1ac5b

[fix] MapMaker/DNS: better handle when zone content is not parseable

View differences:

lib/cyborghood-mapmaker/dns/base.rb
end
def parsed_content(on_disk = false)
parsed_content = ZoneContent.new(@name)
if on_disk or not changed?
parsed_content.import_from_file(@filename)
else
parsed_content.content = @content
begin
parsed_content = ZoneContent.new(@name)
if on_disk or not changed?
parsed_content.import_from_file(@filename)
else
parsed_content.content = @content
end
parsed_content
rescue Dnsruby::ZoneReader::ParseException
# return nil is not parseable
end
parsed_content
end
def parsed_signed_content
return unless has_signed_zone_file?
parsed_content = ZoneContent.new(@name)
parsed_content.import_from_file(@filename_signed)
parsed_content
begin
parsed_content = ZoneContent.new(@name)
parsed_content.import_from_file(@filename_signed)
parsed_content
rescue Dnsruby::ZoneReader::ParseException
# return nil is not parseable
end
end
def changed?
......
def info
hszf = self.has_signed_zone_file?
p_c = self.parsed_content
data = {
:is_master => self.master?,
:has_signed_zone_file => hszf,
:serial_in_zone_file => self.parsed_content.serial
:serial_in_zone_file => p_c.nil? ? nil : p_c.serial
}
if hszf
s_p_c = self.parsed_signed_content
data.merge!({
:serial_in_signed_zone_file => self.parsed_signed_content.serial
:serial_in_signed_zone_file => s_p_c.nil? ? nil : s_p_c.serial
})
end

Also available in: Unified diff