fix: cut off irrelevant seconds-to-TTL in DNS answer

This commit is contained in:
Michael Hinz 2026-02-12 16:26:18 +01:00
commit 5a0c125183

View file

@ -32,10 +32,12 @@ def main():
answer = r.resolve(qname=zone, rdtype='DNSKEY', tcp=False, search=ns)
if not expected:
expected = answer.rrset.to_text()
# print(f"set {expected=}")
expected = expected[expected.find('IN ')]
else:
if answer.rrset.to_text() != expected:
logging.debug(f"{answer.rrset.to_text()=} differs from {expected=}")
answer_text = answer.rrset.to_text()
answer_text = answer_text[answer_text.find('IN ')]
if answer_text != expected:
logging.debug(f"'{answer_text}' differs from '{expected}', bumping SOA record for {zone}")
# I'm very confident this is more complicated than it needs to be...
db.query(f"""SELECT id,content FROM records WHERE type='SOA' AND name='{zone}'""")
result = db.store_result()