[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [ascension] branch master updated: address a few style issu
From: |
gnunet |
Subject: |
[GNUnet-SVN] [ascension] branch master updated: address a few style issues, point to design issues |
Date: |
Wed, 01 May 2019 13:55:38 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository ascension.
The following commit(s) were added to refs/heads/master by this push:
new afc7b21 address a few style issues, point to design issues
afc7b21 is described below
commit afc7b211cc79a93cd9bcd00896f5e8ecf2584d39
Author: Christian Grothoff <address@hidden>
AuthorDate: Wed May 1 13:55:22 2019 +0200
address a few style issues, point to design issues
---
ascension/ascension.py | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/ascension/ascension.py b/ascension/ascension.py
index aa6f826..4ee0145 100644
--- a/ascension/ascension.py
+++ b/ascension/ascension.py
@@ -523,12 +523,12 @@ class Ascender():
serial = serial.decode()
except sp.CalledProcessError:
serial = ""
- soa_serial = 0
+ soa_serial = None
soapattern = re.compile(r'.+\s(\d+),\d+,\d+,\d+,\d+', re.M)
if re.findall(soapattern, serial):
soa_serial = re.findall(soapattern, serial)[0]
else:
- soa_serial = 0
+ soa_serial = None
return soa_serial
@classmethod
@@ -543,6 +543,7 @@ class Ascender():
@classmethod
def get_zone_refresh_time(cls):
"""
+ @deprecated (use from DNS)
Extracts the current refresh time of the zone from GNS
:returns: refresh time of the current SOA record
"""
@@ -553,17 +554,18 @@ class Ascender():
serial = serial.decode()
except sp.CalledProcessError:
serial = ""
- refresh = 0
+ refresh = None
soapattern = re.compile(r'.+\s\d+,(\d+),\d+,\d+,\d+', re.M)
if re.findall(soapattern, serial):
refresh = re.findall(soapattern, serial)[0]
else:
- refresh = 0
+ refresh = None
return int(refresh)
@classmethod
def get_zone_retry_time(cls):
"""
+ @deprecated (use from DNS)
Extracts the current retry time of the zone from GNS
:returns: retry time of the current SOA record
"""
@@ -730,14 +732,14 @@ def main():
try:
sp.check_output([GNUNET_ARM_COMMAND, '-I'], timeout=1)
except sp.TimeoutExpired:
- logging.critical('GNUnet Services are not running!')
+ logging.critical('GNUnet services are not running!')
sys.exit(1)
# Initialize class instance
ascender = Ascender(domain, transferns, port, flags, minimum)
# Event loop for actual daemon
- while 1:
+ while True:
serial = ascender.get_zone_serial()
ascender.initial_zone_transfer(serial)
ascender.mirror_zone()
@@ -747,16 +749,18 @@ def main():
logging.info("Finished migration of the zone %s", ascender.domain)
else:
logging.info("Zone %s already up to date", ascender.domain)
+ # FIXME: use DNS SOA, from above, if fail retry time, if success
refresh time
refresh = int(ascender.get_zone_refresh_time())
retry = int(ascender.get_zone_retry_time())
if standalone:
+ # FIXME: return non-zero on errors!
return 0
- if refresh == 0:
- logging.info("unable to refresh zone, retrying in %ds", retry)
+ if not refresh:
+ logging.info("Unable to refresh zone, retrying in %ds", retry)
time.sleep(retry)
else:
- logging.info("refreshing zone in %ds", refresh)
- print("refreshing zone in %ds" % refresh)
+ logging.info("Refreshing zone in %ds", refresh)
+ print("Refreshing zone in %ds" % refresh)
time.sleep(refresh)
if __name__ == '__main__':
--
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: address a few style issues, point to design issues,
gnunet <=