def delete(self, req, domain, id): result = self.db.dns_getDetail(domain, id) name = result[1] editor = DomainEditor(domain) editor.delDNS(name) ctl = NginxController(domain) ctl.RestartNginx() self.db.dns_del(domain, id)
def edit(self, req, domain, id, **kwargs): result = self.db.dns_getDetail(domain, id) name = result[1] ip = result[2] port = result[3] editor = DomainEditor(domain) editor.delDNS(name) if 'ip' in kwargs: ip = kwargs['ip'] if 'port' in kwargs: port = kwargs['port'] if 'name' in kwargs: name = kwargs['name'] editor.addDNS(name, ip, port) ctl = NginxController(domain) ctl.RestartNginx() self.db.dns_edit(domain, id, name, ip, port)