mirror of
https://github.com/adulau/pdns-qof-server.git
synced 2024-11-24 19:17:06 +00:00
Remove duplicate values from pdns results
The option is by default to remove duplicate. The duplicate can be useful when you have a set of pdns in cluster to validate the result set.
This commit is contained in:
parent
aa0342ecab
commit
02605d1e1c
1 changed files with 12 additions and 1 deletions
|
@ -83,10 +83,21 @@ def getAssociatedRecords(rdata = None):
|
||||||
records.append(v.decode(encoding='UTF-8'))
|
records.append(v.decode(encoding='UTF-8'))
|
||||||
return records
|
return records
|
||||||
|
|
||||||
def JsonQOF(rrfound = None):
|
def RemDuplicate(d = None):
|
||||||
|
if d is None:
|
||||||
|
return False
|
||||||
|
outd = [dict(t) for t in set([tuple(o.items()) for o in d])]
|
||||||
|
return outd
|
||||||
|
|
||||||
|
|
||||||
|
def JsonQOF(rrfound = None, RemoveDuplicate=True):
|
||||||
if rrfound is None:
|
if rrfound is None:
|
||||||
return False
|
return False
|
||||||
rrqof = ""
|
rrqof = ""
|
||||||
|
|
||||||
|
if RemoveDuplicate:
|
||||||
|
rrfound=RemDuplicate(d=rrfound)
|
||||||
|
|
||||||
for rr in rrfound:
|
for rr in rrfound:
|
||||||
rrqof = rrqof + json.dumps(rr) + "\n"
|
rrqof = rrqof + json.dumps(rr) + "\n"
|
||||||
return rrqof
|
return rrqof
|
||||||
|
|
Loading…
Reference in a new issue