From 56d70baa79ae5907b11445364bbea9b31ee4cd20 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Sun, 27 Mar 2016 19:27:30 +0200 Subject: WIP --- tools/submitcert.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'tools/submitcert.py') diff --git a/tools/submitcert.py b/tools/submitcert.py index 91d2111..b185a62 100755 --- a/tools/submitcert.py +++ b/tools/submitcert.py @@ -42,7 +42,9 @@ logpublickey = get_public_key_from_file(args.publickey) if args.publickey else N lookup_in_log = False -if certfilepath[-1] == "/": +if certfilepath is None: + certfiles = None +elif certfilepath[-1] == "/": certfiles = [certfilepath + filename for filename in sorted(os.listdir(certfilepath)) if os.path.isfile(certfilepath + filename)] else: certfiles = [certfilepath] @@ -159,12 +161,17 @@ p = Pool(args.parallel, lambda: signal.signal(signal.SIGINT, signal.SIG_IGN)) nsubmitted = 0 lastprinted = 0 -print "listing certs" -ncerts = get_ncerts(certfiles) - -print ncerts, "certs" +def get_cert_from_stdin(): + yield (('', base64.b64encode(sys.stdin.read()))) -certs = get_all_certificates(certfiles) +print "listing certs" +if certfiles is not None: + ncerts = get_ncerts(certfiles) + print ncerts, "certs" + certs = get_all_certificates(certfiles) +else: + ncerts = 1 + certs = get_cert_from_stdin() (result, timing) = submitcert(certs.next()) if result != None: -- cgit v1.1