Properly checking response code from update

This commit is contained in:
László Károlyi 2024-04-08 16:40:20 +02:00
parent 2a284f7d80
commit 0278fad2fe
Signed by: karolyi
GPG Key ID: 2DCAF25E55735BFE
1 changed files with 4 additions and 2 deletions

View File

@ -14,6 +14,7 @@ from dns.name import Name
from dns.name import from_text as name_from_text
from dns.nameserver import Do53Nameserver
from dns.query import tcp
from dns.rcode import Rcode
from dns.rdataclass import RdataClass
from dns.rdataset import Rdataset
from dns.rdatatype import TLSA, RdataType
@ -200,9 +201,10 @@ class _DnsServerInfo(object):
if dry_run:
continue
response = tcp(q=update, where=self.str_ip)
if not response.errors:
resp_rcode = response.rcode()
if resp_rcode != Rcode.NOERROR:
raise RuntimeError(
f'Update response container errors: {response.errors}')
f'Update failed, return code {resp_rcode!r}')
_serverinfo_cache = dict[Configuration, list[_DnsServerInfo]]()