aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2009-12-28 18:09:23 +0000
committerRob Austein <sra@hactrn.net>2009-12-28 18:09:23 +0000
commite3f985e48c6949f8b1ba7f3b7dce85e59a68738d (patch)
tree19f814c59927a850ce258f8328eaf418e3a0c53b
parent39d9cb9dec12595c3ca5a705342de469d3717875 (diff)
Start adding config file control for all the weird little debugging
and tuning parameters. This may require refactoring eventually, but it's better than having to modify the source code every time. svn path=/rpkid/irdbd.py; revision=2911
-rw-r--r--rpkid/irdbd.py2
-rw-r--r--rpkid/pubd.py2
-rw-r--r--rpkid/rootd.py2
-rw-r--r--rpkid/rpki/config.py40
-rw-r--r--rpkid/rpkid.py2
5 files changed, 48 insertions, 0 deletions
diff --git a/rpkid/irdbd.py b/rpkid/irdbd.py
index 13f3d103..733178e8 100644
--- a/rpkid/irdbd.py
+++ b/rpkid/irdbd.py
@@ -189,6 +189,8 @@ startup_msg = cfg.get("startup-message", "")
if startup_msg:
rpki.log.info(startup_msg)
+cfg.set_debugging_flags()
+
db = MySQLdb.connect(user = cfg.get("sql-username"),
db = cfg.get("sql-database"),
passwd = cfg.get("sql-password"))
diff --git a/rpkid/pubd.py b/rpkid/pubd.py
index 82f3fb93..ceb6bac7 100644
--- a/rpkid/pubd.py
+++ b/rpkid/pubd.py
@@ -176,6 +176,8 @@ def main():
if profile:
rpki.log.info("Running in profile mode with output to %s" % profile)
+ cfg.set_debugging_flags()
+
pctx = pubd_context(cfg)
rpki.https.server(
diff --git a/rpkid/rootd.py b/rpkid/rootd.py
index e9061097..a15a497a 100644
--- a/rpkid/rootd.py
+++ b/rpkid/rootd.py
@@ -283,6 +283,8 @@ rpki.log.init("rootd")
cfg = rpki.config.parser(cfg_file, "rootd")
+cfg.set_debugging_flags()
+
bpki_ta = rpki.x509.X509(Auto_file = cfg.get("bpki-ta"))
rootd_bpki_key = rpki.x509.RSA( Auto_file = cfg.get("rootd-bpki-key"))
rootd_bpki_cert = rpki.x509.X509(Auto_file = cfg.get("rootd-bpki-cert"))
diff --git a/rpkid/rpki/config.py b/rpkid/rpki/config.py
index 07f6bfe3..36fcbd2d 100644
--- a/rpkid/rpki/config.py
+++ b/rpkid/rpki/config.py
@@ -125,3 +125,43 @@ class parser(object):
Get an integer option, perhaps with a default value.
"""
return self._get_wrapper(self.cfg.getint, section, option, default)
+
+ def set_debugging_flags(self):
+ """
+ Consolidated control for all the little debugging controls
+ scattered through the libraries. This doesn't really fit
+ anywhere, it's a method of the parser class because it operates on
+ the parser object and thus fits here less badly than anywhere else.
+ """
+
+ import rpki.https, rpki.x509, rpki.sql, rpki.async
+
+ try:
+ rpki.https.debug_http = self.getboolean("debug_http")
+ except:
+ pass
+
+ try:
+ rpki.https.debug_tls_certs = self.getboolean("debug_tls_certs")
+ except:
+ pass
+
+ try:
+ rpki.x509.CMS_object.debug_cms_certs = self.getboolean("debug_cms_certs")
+ except:
+ pass
+
+ try:
+ rpki.sql.sql_persistent.sql_debug = self.getboolean("sql_debug")
+ except:
+ pass
+
+ try:
+ rpki.async.timer.gc_debug = self.getboolean("gc_debug")
+ except:
+ pass
+
+ try:
+ rpki.async.timer.run_debug = self.getbolean("timer_debug")
+ except:
+ pass
diff --git a/rpkid/rpkid.py b/rpkid/rpkid.py
index e441598a..d16d33f9 100644
--- a/rpkid/rpkid.py
+++ b/rpkid/rpkid.py
@@ -76,6 +76,8 @@ def main():
if profile:
rpki.log.info("Running in profile mode with output to %s" % profile)
+ cfg.set_debugging_flags()
+
gctx = rpki.rpki_engine.rpkid_context(cfg)
gctx.start_cron()