Fix log messages.

This commit is contained in:
Philippe Pittoli 2023-05-08 19:34:57 +02:00
parent f60530750b
commit 35428314b5

View File

@ -89,7 +89,7 @@ class DNSManager::Storage
Response::Success.new Response::Success.new
rescue e rescue e
Baguette::Log.error "trying to add -or update- zone #{zone.domain}: #{e}" Baguette::Log.error "trying to add -or update- zone #{zone.domain}: #{e}"
Response::Error.new "error while updating the domain #{zone.domain}" Response::Error.new "error while adding or updating the domain #{zone.domain}"
end end
def add_rr(user_id : Int32, domain : String, rr : Zone::ResourceRecord) : IPC::JSON def add_rr(user_id : Int32, domain : String, rr : Zone::ResourceRecord) : IPC::JSON
@ -115,7 +115,7 @@ class DNSManager::Storage
# Test RR validity. # Test RR validity.
rr.get_errors.tap do |errors| rr.get_errors.tap do |errors|
unless errors.empty? unless errors.empty?
Baguette::Log.warning "Add RR with errors: #{errors}" Baguette::Log.warning "add RR with errors: #{errors}"
return Response::InvalidZone.new errors return Response::InvalidZone.new errors
end end
end end
@ -135,7 +135,7 @@ class DNSManager::Storage
# User must exist. # User must exist.
user_data = user_data_by_uid.get? user_id.to_s user_data = user_data_by_uid.get? user_id.to_s
unless user_data unless user_data
Baguette::Log.warning "unknown user #{user_id} tries to add -or update- zone #{domain}" Baguette::Log.warning "unknown user #{user_id} tries to update a RR in domain #{domain}"
return Response::UnknownUser.new return Response::UnknownUser.new
end end
@ -174,7 +174,7 @@ class DNSManager::Storage
# User must exist. # User must exist.
user_data = user_data_by_uid.get? user_id.to_s user_data = user_data_by_uid.get? user_id.to_s
unless user_data unless user_data
Baguette::Log.warning "unknown user #{user_id} tries to add -or update- zone #{domain}" Baguette::Log.warning "unknown user #{user_id} tries to delete a RR in domain #{domain}"
return Response::UnknownUser.new return Response::UnknownUser.new
end end
@ -197,8 +197,8 @@ class DNSManager::Storage
Response::Success.new Response::Success.new
rescue e rescue e
Baguette::Log.error "trying to replace a resource record in domain #{domain}: #{e}" Baguette::Log.error "trying to remove a resource record in domain #{domain}: #{e}"
Response::Error.new "error while replacing a resource record in domain #{domain}" Response::Error.new "error while removing a resource record in domain #{domain}"
end end
def delete_domain(user_id : Int32, domain : String) : IPC::JSON def delete_domain(user_id : Int32, domain : String) : IPC::JSON
@ -265,7 +265,7 @@ class DNSManager::Storage
Response::DomainList.new user_data.domains Response::DomainList.new user_data.domains
rescue e rescue e
Baguette::Log.error "while listing all user #{user_id} domains: #{e}" Baguette::Log.error "trying to list all user #{user_id} domains: #{e}"
Response::Error.new "error while listing domains" Response::Error.new "error while listing domains"
end end
end end