In delete action, the function get_serial() return nonzero number when 'recursion' is on
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Designate |
New
|
Undecided
|
Unassigned |
Bug Description
backend: bind9
1.Create a zone named "zepp.com.".
2.Query the serial number from my nameservers with get_serial(
zepp.com. 3600 IN SOA ns3.zepp.com. admin.zepp.com. 1541648152 3546 600 86400 3600
3.Delete the zone.
4.Query the serial number from my nameservers with get_serial(
zepp.com. 794 IN SOA ns-805.
5.Expect 0 but serial number 1 was found, so func parse_query_
code from master branch:
get_serial():
def get_serial(
"""
Possibly raises dns.exception.
Possibly returns 0 if, e.g., the answer section is empty.
"""
resp = dig(zone_name, host, dns.rdatatype.SOA, port=port)
if not resp.answer:
return 0
rdataset = resp.answer[
if not rdataset:
return 0
return rdataset[0].serial
parse_query_
def parse_query_
"""
results is a [serial/None, ...]
"""
delete = zone.action == 'DELETE'
positives = 0
no_zones = 0
low_serial = 0
for serial in results:
if serial is None:
# Intentionally don't handle None
if delete:
if serial == 0:
else:
if serial >= zone.serial:
# Update the lowest valid serial aka the consensus
# serial
if low_serial == 0 or serial < low_serial:
else:
if serial == 0:
result = DNSQueryResult(
LOG.
return result
I suggest to use some attributes to distinguish the zones from different nameservers when 'recursion' is on.
I think I am meeting with the same issue here.
I create the zone in our test cloud bind server but fail to delete it.
The bind server has indeed already deleted the zone in its `zones` view, but since the forwarding is enabled in bind server, it will return the dns query for that zone from other upstream name servers.
Unfortunately, designate does not distinguish that, and keep thinking the serial is not correct and is stuck in ERROR state.