process putatives: break out log_ignore
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 24 Apr 2017 12:21:50 +0000 (13:21 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 24 Apr 2017 12:21:50 +0000 (13:21 +0100)
No significant functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
hippotatlib/__init__.py

index aa5b06c..19a6aef 100644 (file)
@@ -390,6 +390,10 @@ def _cfg_process_putatives():
         server_pat + r' ' + '(?:' + client_pat + '|LIMIT)')
 
   for cs in cfg.sections():
+    def log_ignore(why):
+      print('warning: ignoring config section [%s] (%s)' % (cs, why),
+            file=sys.stderr)
+
     if cs == 'LIMIT' or cs == 'COMMON':
       # plan A "[LIMIT]" or "[COMMON]"
       continue
@@ -417,8 +421,7 @@ def _cfg_process_putatives():
           ci = ipaddr(pc)
         except AddressValueError:
           # plan F "[<some thing we do not understand>]"
-          # well, we ignore this
-          print('warning: ignoring config section %s' % cs, file=sys.stderr)
+          log_ignore('bad-addr')
           continue
 
         else: # no AddressValueError