Parcourir la source

[1261] log message update

JINMEI Tatuya il y a 13 ans
Parent
commit
0fbdaf01b0
2 fichiers modifiés avec 24 ajouts et 17 suppressions
  1. 13 7
      src/bin/xfrin/xfrin.py.in
  2. 11 10
      src/bin/xfrin/xfrin_messages.mes

+ 13 - 7
src/bin/xfrin/xfrin.py.in

@@ -487,30 +487,36 @@ class XfrinConnection(asyncore.dispatcher):
         try:
             ret = XFRIN_OK
             self._request_type = request_type
+            # Right now RRType.[IA]XFR().to_text() is 'TYPExxx', so we need
+            # to hardcode here.
+            request_str = 'IXFR' if request_type == RRType.IXFR() else 'AXFR'
             if check_soa:
                 logstr = 'SOA check for \'%s\' ' % self.zone_str()
                 ret =  self._check_soa_serial()
 
             if ret == XFRIN_OK:
+                logger.info(XFRIN_XFR_TRANSFER_STARTED, request_str,
+                            self.zone_str())
                 if self._request_type == RRType.IXFR():
-                    # TODO: log it
                     self._request_type = RRType.IXFR()
                     self._send_query(self._request_type)
                     self.__state = XfrinInitialSOA()
                     self._handle_xfrin_responses()
                 else:
-                    logger.info(XFRIN_AXFR_TRANSFER_STARTED, self.zone_str())
                     self._send_query(self._request_type)
                     isc.datasrc.sqlite3_ds.load(self._db_file,
                                                 self._zone_name.to_text(),
                                                 self._handle_axfrin_response)
-                    logger.info(XFRIN_AXFR_TRANSFER_SUCCESS, self.zone_str())
+                logger.info(XFRIN_XFR_TRANSFER_SUCCESS, request_str,
+                            self.zone_str())
 
         except (XfrinException, XfrinProtocolError) as e:
-            # TODO: rename it: AXFR->XFR (or remove it)
-            logger.error(XFRIN_AXFR_TRANSFER_FAILURE, self.zone_str(), str(e))
+            logger.error(XFRIN_XFR_TRANSFER_FAILURE, request_str,
+                         self.zone_str(), str(e))
             ret = XFRIN_FAIL
         except isc.datasrc.sqlite3_ds.Sqlite3DSError as e:
+            # Note: this is old code and used only for AXFR.  This will be
+            # soon removed anyway, so we'll leave it.
             logger.error(XFRIN_AXFR_DATABASE_FAILURE, self.zone_str(), str(e))
             ret = XFRIN_FAIL
         except Exception as e:
@@ -522,8 +528,8 @@ class XfrinConnection(asyncore.dispatcher):
             # catch it here, but until then we need broadest coverage so that
             # we won't miss anything.
 
-            # TODO: rename it: both 'AXFR' and 'INTERNAL' are inappropriate
-            logger.error(XFRIN_AXFR_INTERNAL_FAILURE, self.zone_str(), str(e))
+            logger.error(XFRIN_XFR_OTHER_FAILURE, request_str,
+                         self.zone_str(), str(e))
             ret = XFRIN_FAIL
         finally:
             # Make sure any remaining transaction in the diff is closed

+ 11 - 10
src/bin/xfrin/xfrin_messages.mes

@@ -15,25 +15,26 @@
 # No namespace declaration - these constants go in the global namespace
 # of the xfrin messages python module.
 
-% XFRIN_AXFR_INTERNAL_FAILURE AXFR transfer of zone %1 failed: %2
-The AXFR transfer for the given zone has failed due to an internal
-problem in the bind10 python wrapper library.
-The error is shown in the log message.
+% XFRIN_XFR_OTHER_FAILURE %1 transfer of zone %2 failed: %3
+The XFR transfer for the given zone has failed due to a problem outside
+of the xfrin module.  Possible reasons are a broken DNS message or failure
+in database connection.  The error is shown in the log message.
 
 % XFRIN_AXFR_DATABASE_FAILURE AXFR transfer of zone %1 failed: %2
 The AXFR transfer for the given zone has failed due to a database problem.
-The error is shown in the log message.
+The error is shown in the log message.  Note: due to the code structure
+this can only happen for AXFR.
 
-% XFRIN_AXFR_TRANSFER_FAILURE AXFR transfer of zone %1 failed: %2
-The AXFR transfer for the given zone has failed due to a protocol error.
+% XFRIN_XFR_TRANSFER_FAILURE %1 transfer of zone %2 failed: %3
+The XFR transfer for the given zone has failed due to a protocol error.
 The error is shown in the log message.
 
-% XFRIN_AXFR_TRANSFER_STARTED AXFR transfer of zone %1 started
+% XFRIN_XFR_TRANSFER_STARTED %1 transfer of zone %2 started
 A connection to the master server has been made, the serial value in
 the SOA record has been checked, and a zone transfer has been started.
 
-% XFRIN_AXFR_TRANSFER_SUCCESS AXFR transfer of zone %1 succeeded
-The AXFR transfer of the given zone was successfully completed.
+% XFRIN_XFR_TRANSFER_SUCCESS %1 transfer of zone %2 succeeded
+The XFR transfer of the given zone was successfully completed.
 
 % XFRIN_BAD_MASTER_ADDR_FORMAT bad format for master address: %1
 The given master address is not a valid IP address.