From 57b83a85cbd70ade26fa3d7651c3a04441c43813 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Tue, 16 Feb 2016 10:54:56 +0100 Subject: Don't require config if not needed. Local configuration is only used for finding CA cert. Not needed for http://. Global configuration isn't used at all. --- tools/loginfo.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tools/loginfo.py b/tools/loginfo.py index c61ad1b..ff55de9 100755 --- a/tools/loginfo.py +++ b/tools/loginfo.py @@ -21,16 +21,22 @@ def main(): help="Print tree size") parser.add_argument('--signature', action='store_true', help="Print signature") - parser.add_argument('--config', help="System configuration", required=True) - parser.add_argument('--localconfig', help="Local configuration", - required=True) + parser.add_argument('--config', help="System configuration") + parser.add_argument('--localconfig', help="Local configuration") parser.add_argument('baseurl', help="Log base URL") args = parser.parse_args() - #config = yaml.load(open(args.config)) - localconfig = yaml.load(open(args.localconfig)) - paths = localconfig["paths"] - create_ssl_context(cafile=paths["https_cacertfile"]) + paths = None + if (args.localconfig): + localconfig = yaml.load(open(args.localconfig)) + paths = localconfig["paths"] + + if ('https://' in args.baseurl): + if paths is None: + print >>stderr, "need --localconfig for CA cert" + return -1 + create_ssl_context(cafile=paths["https_cacertfile"]) + sth = get_sth(args.baseurl) if args.raw: -- cgit v1.1