diff options
author | Linus Nordberg <linus@nordu.net> | 2016-02-16 10:54:56 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2016-02-16 10:54:56 +0100 |
commit | 57b83a85cbd70ade26fa3d7651c3a04441c43813 (patch) | |
tree | ea5fa54e00e7caba24781ccb91dc3b170846bf86 /tools | |
parent | b7a7da347cdf80018be0dadd1e9158a585d411d7 (diff) |
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.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/loginfo.py | 20 |
1 files 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: |