From a65c4cf08d701a698895847645d1582ebe1a7044 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sun, 3 Apr 2016 00:58:52 +0000 Subject: Move more programs to integrated config+argparse framework. svn path=/branches/tk705/; revision=6346 --- rpki/pubd.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'rpki/pubd.py') diff --git a/rpki/pubd.py b/rpki/pubd.py index fc5dffc7..25c2b551 100644 --- a/rpki/pubd.py +++ b/rpki/pubd.py @@ -57,23 +57,24 @@ class main(object): self.irbe_cms_timestamp = None - 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") - parser.add_argument("--profile", - help = "enable profiling, saving data to PROFILE") - rpki.log.argparse_setup(parser) - args = parser.parse_args() + self.cfg = rpki.config.argparser(section = "pubd", doc = __doc__) + self.cfg.add_boolean_argument("--foreground", + default = False, + help = "whether to daemonize") + self.cfg.add_argument("--pidfile", + default = os.path.join(rpki.daemonize.default_pid_directory, + "pubd.pid"), + help = "override default location of pid file") + self.cfg.add_argument("--profile", + default = "", + help = "enable profiling, saving data to PROFILE") + rpki.log.argparse_setup(self.cfg.argparser) + args = self.cfg.argparser.parse_args() self.profile = args.profile rpki.log.init("pubd", args) - self.cfg = rpki.config.parser(set_filename = args.config, section = "pubd") self.cfg.set_global_flags() if not args.foreground: -- cgit v1.2.3