Revision 80dd9940
Added by Marc Dequènes almost 14 years ago
- ID 80dd9940ce187fe6fede0e734d844cc9a84037ab
bin/mapmaker | ||
---|---|---|
zone = Services::DNS::Zone.new(node_name)
|
||
on_request do |request|
|
||
request.reply.results = {
|
||
:master => zone.master?,
|
||
:signed => zone.signed?,
|
||
:serial => zone.serial_in_dns
|
||
:master => zone.master?,
|
||
:signed => zone.signed?,
|
||
:serial => zone.serial_in_dns
|
||
}
|
||
if zone.master?
|
||
reply.results.merge!({
|
||
:serial_in_zone_file => zone.serial_in_zone_file,
|
||
:serial_in_signed_zone_file => zone.serial_in_signed_zone_file
|
||
request.reply.results.merge!({
|
||
:serial_in_zone_file => zone.serial_in_zone_file,
|
||
:serial_in_signed_zone_file => zone.serial_in_signed_zone_file
|
||
})
|
||
end
|
||
end
|
||
... | ... | |
node "content=" do
|
||
on_request do |request|
|
||
content = request.args.shift
|
||
if content.nil?
|
||
if content.empty?
|
||
request.errors << "Zone content missing"
|
||
return
|
||
end
|
||
|
||
zone.content = content
|
||
if zone.changed?
|
||
check_result = zone.check
|
||
if check_result[:ok]
|
||
reply.warnings = check_result[:warnings]
|
||
request.reply.warnings = check_result[:warnings]
|
||
# zone signer automatically handles serial bump
|
||
if check_result[:serial] > zone.serial or zone.signed?
|
||
zone.save
|
||
zone.activate
|
||
else
|
||
reply.errors << _("Zone serial is not superior to current serial.")
|
||
request.reply.errors << _("Zone serial is not superior to current serial.")
|
||
end
|
||
else
|
||
reply.errors = check_result[:errors]
|
||
request.reply.errors = check_result[:errors]
|
||
zone.cancel_changes
|
||
end
|
||
else
|
||
reply.warnings << _("Zone is unmodified (same content)")
|
||
request.reply.warnings << _("Zone is unmodified (same content)")
|
||
zone.cancel_changes
|
||
end
|
||
end
|
Also available in: Unified diff
[fix] Mapmaker had a few silly mistakes (after several naming changes)