aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki-sql-backup
diff options
context:
space:
mode:
Diffstat (limited to 'rpkid/rpki-sql-backup')
-rwxr-xr-xrpkid/rpki-sql-backup39
1 files changed, 18 insertions, 21 deletions
diff --git a/rpkid/rpki-sql-backup b/rpkid/rpki-sql-backup
index 556aa1ed..0d788ffd 100755
--- a/rpkid/rpki-sql-backup
+++ b/rpkid/rpki-sql-backup
@@ -1,22 +1,24 @@
#!/usr/bin/env python
# $Id$
-#
-# Copyright (C) 2010-2013 Internet Systems Consortium ("ISC")
+#
+# Copyright (C) 2014 Dragon Research Labs ("DRL")
+# Portions copyright (C) 2010-2013 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.
+# copyright notices 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
+# THE SOFTWARE IS PROVIDED "AS IS" AND DRL AND ISC DISCLAIM ALL
+# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DRL OR
+# 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.
-__doc__ = """
+"""
Back up data from SQL databases, looking at config file to figure out
which databases and what credentials to use with them.
@@ -25,7 +27,7 @@ For the moment, this just writes all the SQL to stdout.
import subprocess
import os
-import getopt
+import argparse
import sys
import time
import rpki.config
@@ -33,17 +35,12 @@ import rpki.config
os.environ["TZ"] = "UTC"
time.tzset()
-cfg_file = None
-
-opts, argv = getopt.getopt(sys.argv[1:], "c:h?", ["config=", "help"])
-for o, a in opts:
- if o in ("-h", "--help", "-?"):
- print __doc__
- sys.exit(0)
- elif o in ("-c", "--config"):
- cfg_file = a
+parser = argparse.ArgumentParser(description = __doc__)
+parser.add_argument("-c", "--config",
+ help = "override default location of configuration file")
+args = parser.parse_args()
-cfg = rpki.config.parser(cfg_file, "myrpki")
+cfg = rpki.config.parser(args.config, "myrpki")
def dump(section):
subprocess.check_call(