summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Olof Gunnar Andersson <eandersson@blizzard.com>2019-09-05 20:56:28 -0700
committerErik Olof Gunnar Andersson <eandersson@blizzard.com>2019-09-05 20:56:28 -0700
commitbcaf9fd149e36c437b65220de64a7a195301a337 (patch)
tree68a1cb05da67ffdbb28c3a6cecdbae46ba6a135f
parente080b14422bcec68516067e90d66067a39817e03 (diff)
downloaddesignate-bcaf9fd149e36c437b65220de64a7a195301a337.tar.gz
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
-rw-r--r--designate/mdns/notify.py32
1 files 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",