diff options
author | Magnus Ahltorp <map@kth.se> | 2017-07-26 00:30:49 +0200 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2017-07-26 00:30:49 +0200 |
commit | c730fa9a23b6d27e5361b7ef1c9b97970df0a60d (patch) | |
tree | 86c51be6d1b2f99fc57df128aa58464c3cf357f7 /tools/initlog.py | |
parent | 5105a511348e58629b394373730f9bf91c3e888e (diff) |
Use centralized config parsing in initlog.py
Diffstat (limited to 'tools/initlog.py')
-rwxr-xr-x | tools/initlog.py | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/tools/initlog.py b/tools/initlog.py index 222129c..da63206 100755 --- a/tools/initlog.py +++ b/tools/initlog.py @@ -10,26 +10,11 @@ import sys import os import argparse -import yaml import errno from time import time from base64 import b64encode from certtools import build_merkle_tree, write_file, generate_tree_head_signature -from mergetools import get_sth, perm, get_logorder, hexencode - -def parse_args(): - parser = argparse.ArgumentParser(description="") - parser.add_argument('--promote-secondary', action='store_true') - parser.add_argument('--config', help="System configuration", - required=True) - parser.add_argument('--localconfig', help="Local configuration", - required=True) - - args = parser.parse_args() - config = yaml.load(open(args.config)) - localconfig = yaml.load(open(args.localconfig)) - - return (args, config, localconfig) +from mergetools import get_sth, perm, get_logorder, hexencode, parse_args # TODO: Add a `--init-secondary' option too? @@ -52,7 +37,15 @@ def main(): - write n to minsize - create perm database if it doesn't exist """ - args, config, localconfig = parse_args() + parser = argparse.ArgumentParser(description="") + parser.add_argument('--promote-secondary', action='store_true') + parser.add_argument('--config', help="System configuration", + required=True) + parser.add_argument('--localconfig', help="Local configuration", + required=True) + + args, config, localconfig = parse_args(parser=parser) + paths = localconfig["paths"] own_key = (localconfig["nodename"], "%s/%s-private.pem" % (paths["privatekeys"], |