From: Martin Mares Date: Wed, 7 Aug 2024 20:17:05 +0000 (+0200) Subject: Turned NscZone.root into a property X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=296c5cd5e1a1bac3a1eb2d120417c37950f478e8;p=pynsc.git Turned NscZone.root into a property Previously, the root node sometimes disappeared (e.g., when deleting datasets in NscZone.update_soa). --- diff --git a/nsconfig/core.py b/nsconfig/core.py index e1ca1e9..5ffc534 100644 --- a/nsconfig/core.py +++ b/nsconfig/core.py @@ -270,9 +270,12 @@ class NscZonePrimary(NscZone): self.aliases = [] self.zone = dns.zone.Zone(origin=self.name, rdclass=RdataClass.IN) - self.root = NscNode(self, "") self.update_soa() + @property + def root(self): + return NscNode(self, "") + def update_soa(self) -> None: conf = self.config soa = dns.rdtypes.ANY.SOA.SOA(