From 52e7aea4fa4298860021cfb6063aa03ea0b4708b Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Tue, 11 Jul 2023 02:15:37 +0200 Subject: [PATCH] RRAdded response message. --- src/responses/zone.cr | 8 ++++++++ src/storage.cr | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/responses/zone.cr b/src/responses/zone.cr index ef5cf9c..825c60e 100644 --- a/src/responses/zone.cr +++ b/src/responses/zone.cr @@ -70,5 +70,13 @@ class DNSManager::Response end end DNSManager.responses << RRDeleted + + IPC::JSON.message RRAdded, 19 do + property domain : String + property rr : Storage::Zone::ResourceRecord + def initialize(@domain, @rr) + end + end + DNSManager.responses << RRAdded end diff --git a/src/storage.cr b/src/storage.cr index 3d0aa3a..6dbb16a 100644 --- a/src/storage.cr +++ b/src/storage.cr @@ -168,12 +168,14 @@ class DNSManager::Storage end end + puts "RRID before: #{rr.rrid}" zone << rr + puts "RRID after: #{rr.rrid}" # Update the zone. zones_by_domain.update_or_create zone.domain, zone - Response::Success.new + Response::RRAdded.new zone.domain, rr rescue e Baguette::Log.error "trying to add a resource record in domain #{domain}: #{e}" Response::Error.new "error while adding a resource record in domain #{domain}"