diff options
author | Rob Austein <sra@hactrn.net> | 2012-08-23 01:16:19 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2012-08-23 01:16:19 +0000 |
commit | 09a74536c72d3c30714091743db705177c75dfb8 (patch) | |
tree | 4ac2d511d1a6c5a15a40b77fdf8692eff1464697 /rpkid/tests | |
parent | ae846ed6ba69433c541944f0ff026814684c867c (diff) |
Debug with larger configurations.
svn path=/branches/tk274/; revision=4655
Diffstat (limited to 'rpkid/tests')
-rw-r--r-- | rpkid/tests/yamlconf.py | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/rpkid/tests/yamlconf.py b/rpkid/tests/yamlconf.py index da68bb3f..fff72a0f 100644 --- a/rpkid/tests/yamlconf.py +++ b/rpkid/tests/yamlconf.py @@ -59,10 +59,21 @@ section_regexp = re.compile("\s*\[\s*(.+?)\s*\]\s*$") variable_regexp = re.compile("\s*([-a-zA-Z0-9_]+)\s*=\s*(.+?)\s*$") flat_publication = False -config_overrides = {} only_one_pubd = True yaml_file = None +# The SQL username mismatch between rpkid/examples/rpki.conf and +# rpkid/tests/smoketest.setup.sql is completely stupid and really +# should be cleaned up at some point...but not today, at least not as +# part of writing this program. These default values are wired into +# yamltest to match smoketest.setup.sql, so wire them in here too but +# in a more obvious way. + +config_overrides = { + "irdbd_sql_username" : "irdb", "irdbd_sql_password" : "fnord", + "rpkid_sql_username" : "rpki", "rpkid_sql_password" : "fnord", + "pubd_sql_username" : "pubd", "pubd_sql_password" : "fnord" } + def cleanpath(*names): return os.path.normpath(os.path.join(*names)) @@ -337,8 +348,11 @@ class allocation(object): @property def irdb(self): - self.host.zoo.reset_identity(self.name) - return rpki.irdb.database(self.irdb_name) + prior_name = self.zoo.handle + return rpki.irdb.database( + self.irdb_name, + on_entry = lambda: self.zoo.reset_identity(self.name), + on_exit = lambda: self.zoo.reset_identity(prior_name)) def syncdb(self): import django.core.management @@ -351,11 +365,15 @@ class allocation(object): def hire_zookeeper(self): assert not self.is_hosted - self.zoo = rpki.irdb.Zookeeper( + self._zoo = rpki.irdb.Zookeeper( cfg = rpki.config.parser(self.path("rpki.conf")), logstream = sys.stdout) @property + def zoo(self): + return self.host._zoo + + @property def identity(self): self._identity.seek(0) return self._identity @@ -452,15 +470,17 @@ def main(): # example without publishing my own server's passwords. cfg = rpki.config.parser(cfg_file, "yamlconf", allow_missing = True) - cfg.set_global_flags() - - example_cfg = rpki.config.parser(rpki_conf, "myrpki") + try: + cfg.set_global_flags() + except: + pass only_one_pubd = cfg.getboolean("only_one_pubd", True) for k in ("rpkid_sql_password", "irdbd_sql_password", "pubd_sql_password", "rpkid_sql_username", "irdbd_sql_username", "pubd_sql_username"): - config_overrides[k] = cfg.get(k) if cfg.has_option(k) else example_cfg.get(k) + if cfg.has_option(k): + config_overrides[k] = cfg.get(k) if profile: import cProfile @@ -574,7 +594,7 @@ def body(): for d in db: print "Creating identity", d.name with d.irdb: - d.identity = d.host.zoo.initialize() + d.identity = d.zoo.initialize() for d in db: print |