Beispiel #1
0
 def add(self, v):
     rec=Records()
     rec.domain_id=self.domain_id
     rec.name=rec.name=v.name+"."+self.zone_name if v.name else self.zone_name
     rec.name=DNSRecord.normname(rec.name)
     rec.type=v.type
     rec.content=v.content
     rec.ttl=v.ttl
     rec.prio=v.priority
     rec.change_date=int(time.time())
     self.session.add(rec)
     self.session.flush()
     LOG.info("[%s]: Record (%s, %s, '%s') was added" %
         (self.zone_name, rec.name, rec.type, rec.content))
     self._update_serial(rec.change_date)
     if v.name:
         top_level_zone=".".join(self.zone_name.split(".")[1:])
         file_name= FLAGS.dns_powerdns_geomaps_dir+ "/" + v.name  + "." + top_level_zone
         with open(file_name,"w") as f:
             f.write("$RECORD %s\n"%(v.name))
             f.write("$ORIGIN %s\n"%(top_level_zone))
             f.write("0   %s.external\n"%(v.name))
             f.write("900 %s.internal\n"%(v.name))
             f.flush()
             subprocess.call(["sudo","pdns_control","rediscover"])
     subprocess.call(['sudo','pdnssec','--config-dir=/etc/powerdns/pdnssec','rectify-zone',self.zone_name])
     return "ok"
Beispiel #2
0
 def add(self, v):
     rec=Records()
     rec.domain_id=self.domain_id
     rec.name=rec.name=v.name+"."+self.zone_name if v.name else self.zone_name
     rec.name=DNSRecord.normname(rec.name)
     rec.type=v.type
     rec.content=v.content
     rec.ttl=v.ttl
     rec.prio=v.priority
     rec.change_date=int(time.time())
     self.session.add(rec)
     self.session.flush()
     LOG.info("[%s]: Record (%s, %s, '%s') was added" %
         (self.zone_name, rec.name, rec.type, rec.content))
     self._update_serial(rec.change_date)
     return "ok"
Beispiel #3
0
 def add(self, v):
     rec = Records()
     rec.domain_id = self.domain_id
     rec.name = rec.name = v.name + "." + self.zone_name if v.name else self.zone_name
     rec.name = DNSRecord.normname(rec.name)
     rec.type = v.type
     rec.content = v.content
     rec.ttl = v.ttl
     rec.prio = v.priority
     rec.change_date = int(time.time())
     self.session.add(rec)
     self.session.flush()
     LOG.info("[%s]: Record (%s, %s, '%s') was added" % (self.zone_name, rec.name, rec.type, rec.content))
     self._update_serial(rec.change_date)
     return "ok"