Beispiel #1
0
    def async_POST(self, request):
        ttl_ = self.postdata.get('ttl', '3600')
        try:
            if int(ttl_) < 3600:
                ttl_ = 3600
        except Exception as e:
            debug_out('Exception: %s', str(e))
            ttl_ = 3600

        email_ = self.postdata.get(
            'emailAddress', '*****@*****.**').replace('@', '.')
        #TODO email.regex-match

        path_ = path_reverse(self.domain) + '.__data__.SOA.0'
        q = '__path__ == %s AND zone == %s' % (path_, self.domain)
        result = yield search_all(q)
        if len(result) > 0:
            defer.returnValue(RESTResult(code=400, content=dict(
                status='fail',
                reason='zone exist.')))

        soa = new_soa(rname=email_, expire=ttl_)
        rrdata = dict(ttl=ttl_,
                      hc=0,
                      name=self.domain,
                      type='SOA',
                      zone=self.domain,
                      ratio='1',
                      region='default',
                      content=soa,
                      answer=soa)

        data_ = dict(path=path_, model='domain', value=rrdata)
        result = yield proxy_upsert([data_])
        defer.returnValue(RESTResult(code=201, content=dict(affected=result)))
Beispiel #2
0
    def async_POST(self, request):
        debug_out(self.postdata)

        lst_cname = list()
        lst_common = list()
        print lst_cname

        def _filter_cname():
            pass

        #1. no soa
        #2. check cname
        # zone, minTTL
        #
        result = yield proxy_upsert(lst_common)
        defer.returnValue(RESTResult(code=200, content=dict(affected=result)))