Exemplo n.º 1
0
        def pdns_do(self):
            data = {
                'rrsets':
                    [
                        {
                            'name': RRset.construct_name(subname, self._domain_name),
                            'type': type_,
                            'ttl': 1,  # some meaningless integer required by pdns's syntax
                            'changetype': 'REPLACE',  # don't use "DELETE" due to desec-stack#220, PowerDNS/pdns#7501
                            'records': []
                        }
                        for type_, subname in self._deletions
                    ] + [
                        {
                            'name': RRset.construct_name(subname, self._domain_name),
                            'type': type_,
                            'ttl': RRset.objects.values_list('ttl', flat=True).get(domain__name=self._domain_name,
                                                                                   type=type_, subname=subname),
                            'changetype': 'REPLACE',
                            'records': [
                                {'content': rr.content, 'disabled': False}
                                for rr in RR.objects.filter(
                                    rrset__domain__name=self._domain_name,
                                    rrset__type=type_,
                                    rrset__subname=subname)
                            ]
                        }
                        for type_, subname in (self._additions | self._modifications) - self._deletions
                    ]
            }

            if data['rrsets']:
                _pdns_patch(NSLORD, '/zones/' + self.domain_pdns_id, data)
Exemplo n.º 2
0
 def update_catalog(self, delete=False):
     return _pdns_patch(
         NSMASTER, '/zones/' + pdns_id(settings.CATALOG_ZONE), {
             'rrsets': [
                 construct_catalog_rrset(zone=self.domain_name,
                                         delete=delete)
             ]
         })
Exemplo n.º 3
0
 def update_catalog(self, delete=False):
     content = _pdns_patch(
         NSMASTER, '/zones/' + pdns_id(settings.CATALOG_ZONE), {
             'rrsets': [
                 construct_catalog_rrset(zone=self.domain_name,
                                         delete=delete)
             ]
         })
     metrics.get('desecapi_pdns_catalog_updated').inc()
     return content