summaryrefslogtreecommitdiff
path: root/tools/initlog.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/initlog.py')
-rwxr-xr-xtools/initlog.py27
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"],