gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [ascension] branch master updated: nicer logging, coding st


From: gnunet
Subject: [GNUnet-SVN] [ascension] branch master updated: nicer logging, coding style, eliminate duplicate calls
Date: Wed, 01 May 2019 14:15:55 +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 825192a  nicer logging, coding style, eliminate duplicate calls
825192a is described below

commit 825192a3e9042f2d657f6e3e70e3bc934f1d5d5c
Author: Christian Grothoff <address@hidden>
AuthorDate: Wed May 1 14:15:37 2019 +0200

    nicer logging, coding style, eliminate duplicate calls
---
 ascension/ascension.py | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/ascension/ascension.py b/ascension/ascension.py
index 1366020..fa22f15 100644
--- a/ascension/ascension.py
+++ b/ascension/ascension.py
@@ -142,10 +142,10 @@ class Ascender():
         try:
             soa_answer = dns.resolver.query(domain, 'SOA')
         except dns.resolver.NoAnswer:
-            logging.warning("the domain '%s' is not publicly resolvable",
+            logging.warning("The domain '%s' is not publicly resolvable.",
                             domain)
         except dns.resolver.NXDOMAIN:
-            logging.warning("the domain '%s' is not publicly resolvable",
+            logging.warning("The domain '%s' is not publicly resolvable.",
                             domain)
         master_answer = dns.resolver.query(soa_answer[0].mname, 'A')
         try:
@@ -157,12 +157,14 @@ class Ascender():
                     master_answer[0].address, domain,
                     port=cls.port))
         except dns.resolver.NoAnswer:
-            logging.error("nameserver for '%s' did not answer", domain)
+            logging.error("Nameserver for '%s' did not answer.", domain)
         except dns.exception.FormError:
-            logging.critical("domain '%s' does not allow xfr requests", domain)
+            logging.critical("Domain '%s' does not allow xfr requests.", 
domain)
+            # FIXME: do not exit, throw exception, catch in main, retry based 
on GNS SOA (or default value)
             sys.exit(1)
         except dns.query.TransferError:
-            logging.critical("domain '%s' does not allow xfr requests", domain)
+            logging.critical("Domain '%s' does not allow xfr requests.", 
domain)
+            # FIXME: do not exit, throw exception, catch in main, retry based 
on GNS SOA (or default value)
             sys.exit(1)
         for soa_record in zone.iterate_rdatas(rdtype=dns.rdatatype.SOA):
             if not cls.transferns:
@@ -174,30 +176,28 @@ class Ascender():
             return soa_record[2].serial
 
     @classmethod
-    def mirror_zone(cls, gns_zone_serial=None):
+    def mirror_zone(cls, gns_zone_serial):
         """
         Extract necessary information from Generator
         """
         dns_zone_serial = int(cls.get_dns_zone_serial(cls.domain, 
cls.transferns))
-        if gns_zone_serial == 0:
-            logging.info("zone does not exist yet")
-            cls.initial_zone_transfer()
+        if not gns_zone_serial:
+            logging.info("GNS zone does not exist yet, performing full 
transfer.")
             try:
                 cls.zone = dns.zone.from_xfr(cls.zonegenerator,
                                              check_origin=False)
             except dns.zone.BadZone:
                 logging.critical("Malformed DNS Zone '%s'", cls.domain)
             cls.soa = cls.get_zone_soa(cls.zone)
-        elif gns_zone_serial < dns_zone_serial:
-            logging.info("zone is out of date")
-            cls.initial_zone_transfer(serial=gns_zone_serial)
+        elif int(gns_zone_serial) < dns_zone_serial:
+            logging.info("GNS zone is out of date, performing incremental 
transfer.")
             try:
                 cls.zone = dns.zone.from_xfr(cls.zonegenerator)
             except dns.zone.BadZone:
                 logging.critical("Malformed DNS Zone '%s'", cls.domain)
             cls.soa = cls.get_zone_soa(cls.zone)
-        elif gns_zone_serial == dns_zone_serial:
-            logging.info("zone is up to date")
+        elif int(gns_zone_serial) == dns_zone_serial:
+            logging.info("GNS zone is up to date.")
         # should be unnecessary but AXFR SOA might not be equal to direct SOA
         else:
             # because it runs as a daemon, ignore this case but log it

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]