aboutsummaryrefslogtreecommitdiff
path: root/rpki/pubd.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-04-03 00:58:52 +0000
committerRob Austein <sra@hactrn.net>2016-04-03 00:58:52 +0000
commita65c4cf08d701a698895847645d1582ebe1a7044 (patch)
tree407f8d808cf113dbef73cfdb8c79cc3d220ac35c /rpki/pubd.py
parent5966fae58e2f3bfb226dec71477adb1d96baf5d5 (diff)
Move more programs to integrated config+argparse framework.
svn path=/branches/tk705/; revision=6346
Diffstat (limited to 'rpki/pubd.py')
-rw-r--r--rpki/pubd.py25
1 files changed, 13 insertions, 12 deletions
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: