1. George Notaras
  2. django-powerdns-manager


George Notaras  committed 264e273

Improved how the missing TTL of SOA RRs is updated.

  • Participants
  • Parent commits 2a9b2af
  • Branches default

Comments (0)

Files changed (2)

File src/powerdns_manager/forms.py

View file
  • Ignore whitespace
     are concatenated in save() to form the SOA RR content that PowerDNS expects
     to find stored in the database.
+    Also, if TTl information is missing, then the default TTL (mandatory field)
+    is used.
     primary = forms.CharField(max_length=96, initial='', required=True, label=_('primary nameserver'), help_text="""The name of the name server that was the original or primary source of data for this zone.""")
     hostmaster = forms.CharField(max_length=64, initial='', required=True, label=_('hostmaster mailbox'), help_text="""A name which specifies the mailbox of the person responsible for this zone. This should be specified in the mailbox-as-domain-name format where the `@' character is replaced with a dot. Example: hostmaster.domain.tld represents hostmaster@domain.tld""")
     def save(self, *args, **kwargs):
         self.instance.type = 'SOA'
-        # TODO: Check which other fields need to be set here. auth, ordername, change_date
         self.instance.content = '%s %s %d %s %s %s %s' % (
+        if not self.instance.ttl:
+            self.instance.ttl = self.cleaned_data.get('default_ttl')
         return super(SoaRecordModelForm, self).save(*args, **kwargs)

File src/powerdns_manager/signal_cb.py

View file
  • Ignore whitespace
     This is done according to the following rules:
-    1) TTL of SOA RRs is not modified. The TTL field is mandatory on SOA
-    records (see forms.SoaRecordModelForm) and also defines the minimum TTL
-    get_minimum_ttl() retrieves.
+    1) TTL of SOA RRs is not modified here. Missing TTL information is handled
+    in forms.SoaRecordModelForm.save() method. The minimum TTL is retrieved
+    from the SOA content field, so it would make no sense to set it in this
+    callback.
     2) If the RR is not a SOA and if TTL is missing, the minimum TTL of
     the zone (as defined in the SOA record) will be used. If a SOA record