chiark / gitweb /
rename "password" to "secret" everywhere
[hippotat.git] / hippotatlib / __init__.py
index 0f59f0dc625389e5b64171bde4b195fae0dcdd66..282266c009651b004ec940f7b79aac2b84f5c3c7 100644 (file)
@@ -157,7 +157,7 @@ vvnetwork = 172.24.230.192
 
 
 # [<client-ip4-or-ipv6-address>]
-# password = <password>    # used by both, must match
+# secret = <secret>    # used by both, must match
 
 [LIMIT]
 max_batch_down = 262144
@@ -390,16 +390,17 @@ def _cfg_process_putatives():
         server_pat + r' ' + '(?:' + client_pat + '|LIMIT)')
 
   for cs in cfg.sections():
-    log_debug_config('putatives: section [%s]...' % (cs))
+    def dbg(m):
+      log_debug_config('putatives: section [%s] %s' % (cs, m))
 
     def log_ignore(why):
-      log_debug_config('putatives: section [%s] X ignore: %s' % (cs, why))
+      dbg('X ignore: %s' % (why))
       print('warning: ignoring config section [%s] (%s)' % (cs, why),
             file=sys.stderr)
 
     if cs == 'LIMIT' or cs == 'COMMON':
       # plan A "[LIMIT]" or "[COMMON]"
-      log_debug_config('putatives: section [%s] A ignore' % (cs))
+      dbg('A ignore')
       continue
 
     try:
@@ -409,7 +410,7 @@ def _cfg_process_putatives():
 
       if server_re.fullmatch(cs):
         # plan C "[<servername>]"
-        log_debug_config('putatives: section [%s] C <server>' % (cs))
+        dbg('C <server>')
         putative(servers, cs, cs)
         continue
 
@@ -419,7 +420,7 @@ def _cfg_process_putatives():
 
         if pcs == 'LIMIT':
           # plan E "[<servername> LIMIT]"
-          log_debug_config('putatives: section [%s] E <server> LIMIT' % (cs))
+          dbg('E <server> LIMIT')
           continue
 
         try:
@@ -432,8 +433,7 @@ def _cfg_process_putatives():
 
         else: # no AddressValueError
           # plan D "[<servername> <client>]" part 3
-          log_debug_config('putatives: section [%s] D <server> <client>'
-                           % (cs))
+          dbg('D <server> <client>')
           putative(clients, ci, pcs)
           putative(servers, pss, pss)
           continue
@@ -443,7 +443,7 @@ def _cfg_process_putatives():
 
     else: # no AddressValueError
       # plan B "[<client>" part 2
-      log_debug_config('putatives: section [%s] B <client>' % (cs))
+      dbg('B <client>')
       putative(clients, ci, cs)
       continue
 
@@ -521,7 +521,7 @@ def cfg_process_client_limited(cc,ss,sections,key):
   cc.__dict__[key] = min(val,lim)
 
 def cfg_process_client_common(cc,ss,cs,ci):
-  # returns sections to search in, iff password is defined, otherwise None
+  # returns sections to search in, iff secret is defined, otherwise None
   cc.ci = ci
 
   sections = ['%s %s' % (ss,cs),
@@ -529,11 +529,11 @@ def cfg_process_client_common(cc,ss,cs,ci):
               ss,
               'COMMON']
 
-  try: pwsection = cfg_search_section('password', sections)
+  try: pwsection = cfg_search_section('secret', sections)
   except NoOptionError: return None
     
-  pw = cfg1get(pwsection, 'password')
-  cc.password = pw.encode('utf-8')
+  pw = cfg1get(pwsection, 'secret')
+  cc.secret = pw.encode('utf-8')
 
   cfg_process_client_limited(cc,ss,sections,'target_requests_outstanding')
   cfg_process_client_limited(cc,ss,sections,'http_timeout')
@@ -607,7 +607,7 @@ def common_startup(process_cfg):
 
   def read_defconfig():
     readconfig('/etc/hippotat/config.d', False)
-    readconfig('/etc/hippotat/passwords.d', False)
+    readconfig('/etc/hippotat/secrets.d', False)
     readconfig('/etc/hippotat/master.cfg',   False)
 
   def oc_defconfig(od,os, value, op):