From 01697787912f143ab2b9a938e33c73c9a8a9ae0b Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Tue, 26 Apr 2016 20:07:41 +0000 Subject: 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 --- rpki/rootd.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'rpki/rootd.py') 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: -- cgit v1.2.3