From: Ian Jackson Date: Sun, 9 Apr 2017 12:01:08 +0000 (+0100) Subject: hippotatd: support --print-config X-Git-Url: https://git.distorted.org.uk/~mdw/hippotat/commitdiff_plain/bb450e0a353c3f4c13a9c198dd25018713996472 hippotatd: support --print-config Signed-off-by: Ian Jackson --- diff --git a/hippotatd b/hippotatd index e3e42fb..a235929 100755 --- a/hippotatd +++ b/hippotatd @@ -326,6 +326,12 @@ def process_cfg(_opts, putative_servers, putative_clients): ('peer', 'vrelay'), ('rnets','vnetwork'))) + if opts.printconfig is not None: + try: val = cfg.get(c.server, opts.printconfig) + except NoOptionError: pass + else: print(val) + sys.exit(0) + def catch_termination(): def run_cleanups(): for cleanup in cleanups: @@ -446,6 +452,12 @@ optparser.add_option('--syslog-facility', default=None, help='log to syslog, with specified facility') +optparser.add_option('--print-config', + nargs=1, type='string',action='store', + metavar='OPTION', dest='printconfig', + default=None, + help='print one config option value and exit') + common_startup(process_cfg) catch_termination() start_http()