From bcaf9fd149e36c437b65220de64a7a195301a337 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Thu, 5 Sep 2019 20:56:28 -0700 Subject: Only log zone not found when notifing We are currently logging zone not found when quering the SOA record. This should only happen when notifing. Change-Id: Iad790593a809a165718d3700cf7325f52208dab1 Closes-Bug: #1671636 --- designate/mdns/notify.py | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/designate/mdns/notify.py b/designate/mdns/notify.py index a8f54b05..0de21f5c 100644 --- a/designate/mdns/notify.py +++ b/designate/mdns/notify.py @@ -252,21 +252,29 @@ class NotifyEndpoint(base.BaseEndpoint): # recover by retrying break + if not response: + return None, retry + # Check that we actually got a NOERROR in the rcode and and an # authoritative answer - if response is None: - pass - - elif (response.rcode() in - (dns.rcode.NXDOMAIN, dns.rcode.REFUSED, - dns.rcode.SERVFAIL)) or \ + refused_statuses = ( + dns.rcode.NXDOMAIN, dns.rcode.REFUSED, dns.rcode.SERVFAIL + ) + if (response.rcode() in refused_statuses or (response.rcode() == dns.rcode.NOERROR and - not bool(response.answer)): - LOG.info("%(zone)s not found on %(server)s:%(port)d", - {'zone': zone.name, 'server': host, 'port': port}) - - elif not (response.flags & dns.flags.AA) or dns.rcode.from_flags( - response.flags, response.ednsflags) != dns.rcode.NOERROR: + not bool(response.answer))): + if notify: + LOG.info( + '%(zone)s not found on %(server)s:%(port)d', + { + 'zone': zone.name, + 'server': host, + 'port': port + } + ) + elif (not (response.flags & dns.flags.AA) or + dns.rcode.from_flags(response.flags, + response.ednsflags) != dns.rcode.NOERROR): LOG.warning("Failed to get expected response while trying to " "send '%(msg)s' for '%(zone)s' to '%(server)s:" "%(port)d'.\nResponse message:\n%(resp)s\n", -- cgit v1.2.1