From c730fa9a23b6d27e5361b7ef1c9b97970df0a60d Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Wed, 26 Jul 2017 00:30:49 +0200 Subject: Use centralized config parsing in initlog.py --- tools/mergetools.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'tools/mergetools.py') diff --git a/tools/mergetools.py b/tools/mergetools.py index 0afec24..62b11e4 100644 --- a/tools/mergetools.py +++ b/tools/mergetools.py @@ -417,17 +417,18 @@ def get_missingentriesforbackup(node, baseurl, own_key, paths): def chunks(l, n): return [l[i:i+n] for i in range(0, len(l), n)] -def parse_args(): - parser = argparse.ArgumentParser(description="") - parser.add_argument('node', nargs='*', help="Node to operate on") - parser.add_argument('--config', help="System configuration", - required=True) - parser.add_argument('--localconfig', help="Local configuration", - required=True) - parser.add_argument('--interval', type=int, metavar="n", - help="Repeate every N seconds") - parser.add_argument("--timing", action='store_true', - help="Print timing information") +def parse_args(parser=None): + if parser == None: + parser = argparse.ArgumentParser(description="") + parser.add_argument('node', nargs='*', help="Node to operate on") + parser.add_argument('--config', help="System configuration", + required=True) + parser.add_argument('--localconfig', help="Local configuration", + required=True) + parser.add_argument('--interval', type=int, metavar="n", + help="Repeate every N seconds") + parser.add_argument("--timing", action='store_true', + help="Print timing information") args = parser.parse_args() localconfig = readconfig.read_config(args.localconfig) -- cgit v1.1