aboutsummaryrefslogtreecommitdiff
path: root/rpki/rootd.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-04-26 20:07:41 +0000
committerRob Austein <sra@hactrn.net>2016-04-26 20:07:41 +0000
commit01697787912f143ab2b9a938e33c73c9a8a9ae0b (patch)
tree8065ac9a88d697678de0ad68c13683c6c2f5dd69 /rpki/rootd.py
parent1447a61b235699163f186ef689ca8eaf898ee478 (diff)
Further consolidation of config file parsing, command line parsing,
and logging setup. Most programs now use the unified mechanism, although there are still a few holdouts: the GUI, which is a special case because it has no command line, and the rpki-rtr program, which, for historical reasons has its own implementation of the logging setup infrastructure. svn path=/branches/tk705/; revision=6390
Diffstat (limited to 'rpki/rootd.py')
-rw-r--r--rpki/rootd.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/rpki/rootd.py b/rpki/rootd.py
index 70669345..dca60956 100644
--- a/rpki/rootd.py
+++ b/rpki/rootd.py
@@ -399,19 +399,18 @@ class main(object):
os.environ["TZ"] = "UTC"
time.tzset()
- parser = argparse.ArgumentParser(description = __doc__)
- parser.add_argument("-c", "--config",
- help = "override default location of configuration file")
- parser.add_argument("-f", "--foreground", action = "store_true",
- help = "do not daemonize")
- parser.add_argument("--pidfile",
- help = "override default location of pid file")
- rpki.log.argparse_setup(parser)
+ self.cfg = rpki.config.argparser(section = "rootd", doc = __doc__)
+ self.cfg.add_boolean_argument("--foreground", default = False,
+ help = "do not daemonize")
+ self.cfg.add_argument("--pidfile",
+ default = os.pat.join(rpki.daemonize.default_pid_directory,
+ "rootd.pid"),
+ help = "override default location of pid file")
+ self.cfg.add_logging_arguments()
args = parser.parse_args()
- rpki.log.init("rootd", args)
+ self.cfg.configure_logging(args = args, ident = "rootd")
- self.cfg = rpki.config.parser(set_filename = args.config, section = "rootd")
self.cfg.set_global_flags()
if not args.foreground: