hippotatd: support --print-config
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 9 Apr 2017 12:01:08 +0000 (13:01 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 9 Apr 2017 12:01:08 +0000 (13:01 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
hippotatd

index e3e42fb..a235929 100755 (executable)
--- 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()