[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [ascension] branch master updated: changed run to Popen for
From: |
gnunet |
Subject: |
[GNUnet-SVN] [ascension] branch master updated: changed run to Popen for async processing, fixed zone creation bug |
Date: |
Sat, 29 Jun 2019 12:41:14 +0200 |
This is an automated email from the git hooks/post-receive script.
rexxnor pushed a commit to branch master
in repository ascension.
The following commit(s) were added to refs/heads/master by this push:
new 7623c3b changed run to Popen for async processing, fixed zone
creation bug
7623c3b is described below
commit 7623c3bd29f73afc7aaac07192e2f497736f5602
Author: rexxnor <address@hidden>
AuthorDate: Sat Jun 29 12:39:43 2019 +0200
changed run to Popen for async processing, fixed zone creation bug
---
ascension/ascension.py | 59 +++++++++++++++++++++++++++++++-------------------
1 file changed, 37 insertions(+), 22 deletions(-)
diff --git a/ascension/ascension.py b/ascension/ascension.py
index 31f0bc8..36fdfbf 100644
--- a/ascension/ascension.py
+++ b/ascension/ascension.py
@@ -345,26 +345,22 @@ class Ascender():
len(recordline)/2, label)
if privkey:
- ret = sp.run([GNUNET_NAMESTORE_COMMAND,
- '-z', zonename,
- '-n', str(label),
- ] + recordline,
- env=dict(os.environ, **{
- "GNUNET_NAMESTORE_EGO_PRIVATE_KEY": privkey
- }))
+ ret = sp.Popen([GNUNET_NAMESTORE_COMMAND,
+ '-z', zonename,
+ '-n', str(label),
+ ] + recordline,
+ env=dict(os.environ, **{
+ "GNUNET_NAMESTORE_EGO_PRIVATE_KEY": privkey
+ }))
else:
- ret = sp.run([GNUNET_NAMESTORE_COMMAND,
- '-z', zonename,
- '-n', str(label),
- ] + recordline,
- )
+ ret = sp.Popen([GNUNET_NAMESTORE_COMMAND,
+ '-z', zonename,
+ '-n', str(label),
+ ] + recordline,
+ )
- if ret.returncode != 0:
- logging.warning("failed adding record with name %s",
- ' '.join(ret.args))
- else:
- logging.info("successfully added record with command %s",
- ' '.join(ret.args))
+ logging.info("added record with command %s",
+ ' '.join(ret.args))
def resolve_glue(self,
authorityname: str) -> list:
@@ -433,7 +429,7 @@ class Ascender():
if str(value)[-1] == ".":
# FQDN provided
if value.endswith(".%s." % zonename):
- # in bailiwick
+ # in bailiwick
value = self.resolve_glue(record.target)
else:
# out of bailiwick
@@ -660,11 +656,17 @@ class Ascender():
# Check if a delegated zone is available in GNS as per NS record
# Adds NS records that contain "gns--pkey--" to dictionary
nsrecords = self.zone.iterate_rdatasets(dns.rdatatype.NS)
+ nameserverlist = list()
for nsrecord in nsrecords:
name = str(nsrecord[0])
values = nsrecord[1]
ttl = values.ttl
+ # save DNS name object of nameservers for later
+ for nameserver in values:
+ nameserverlist.append(nameserver.target)
+
+ # filter for gns--pkey record in rdatas
gnspkeys = list(filter(lambda record:
str(record).startswith('gns--pkey--'),
values))
@@ -693,9 +695,17 @@ class Ascender():
logging.critical("PKEY in DNS does not match PKEY in GNS
for name %s", name)
continue
- # Create missing zones (and add to dict) for GNS zones that are NOT
DNS zones
- # ("." is not a zone-cut in DNS, but always in GNS).
- for name in self.zone.nodes.keys():
+ # Create missing zones (and add to dict) for GNS zones that are NOT DNS
+ # zones ("." is not a zone-cut in DNS, but always in GNS). Only add the
+ # records that there are no NS records for
+ remaining_nsrecords = list(filter(lambda name: not name.is_absolute(),
+ nameserverlist))
+ remaining = list(filter(lambda name: name not in remaining_nsrecords,
+ self.zone.nodes.keys()))
+ final = list(filter(lambda name: len(str(name).split('.')) > 1,
+ remaining))
+
+ for name in final:
subzones = str(name).split('.')
for i in range(1, len(subzones)):
subdomain = ".".join(subzones[i:])
@@ -804,11 +814,16 @@ def main():
continue
else:
logging.info("GNS zone is out of date, performing incremental
transfer.")
+ if standalone:
+ return 1
print("GNS zone is out of date, performing incremental transfer.")
try:
+ start = time.time()
ascender.zone = dns.zone.from_xfr(ascender.zonegenerator,
check_origin=False)
+ end = time.time()
+ print("Zone transferrred in %s seconds" % str(end - start))
ascender.soa = ascender.get_zone_soa(ascender.zone)
refresh = int(str(ascender.soa[2]).split(" ")[3])
retry = int(str(ascender.soa[2]).split(" ")[4])
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [ascension] branch master updated: changed run to Popen for async processing, fixed zone creation bug,
gnunet <=