diff options
author | Rob Austein <sra@hactrn.net> | 2009-07-08 17:56:37 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2009-07-08 17:56:37 +0000 |
commit | b0efb7fe8e09cefd2ef7a595809efc8b33c2a06a (patch) | |
tree | 4d21c9d2566a0df43287785330470b8bd2241326 /myrpki/sql-cleaner.py | |
parent | 8893d6699c8c1cda621e616a8074cbdaada6b732 (diff) |
Ready for initial smoketest.
svn path=/myrpki/Makefile; revision=2598
Diffstat (limited to 'myrpki/sql-cleaner.py')
-rw-r--r-- | myrpki/sql-cleaner.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/myrpki/sql-cleaner.py b/myrpki/sql-cleaner.py new file mode 100644 index 00000000..889b9955 --- /dev/null +++ b/myrpki/sql-cleaner.py @@ -0,0 +1,36 @@ +""" +(Re)Initialize SQL tables used by these programs. + +$Id$ + +Copyright (C) 2009 Internet Systems Consortium ("ISC") + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +""" + +import subprocess, ConfigParser + +for name in ("rpkid", "irdbd", "pubd"): + + try: + cfg = ConfigParser.RawConfigParser() + cfg.read("%s.conf" % name) + username = cfg.get(name, "sql-username") + database = cfg.get(name, "sql-database") + password = cfg.get(name, "sql-password") + + except: + print "Cleaner couldn't read %s config file, ignoring" % name + continue + + subprocess.check_call(("mysql", "-u", username, "-p" + password, database), stdin = open("../rpkid/%s.sql" % name)) |