diff options
Diffstat (limited to 'tools/submitcert.py')
-rwxr-xr-x | tools/submitcert.py | 19 |
1 files changed, 13 insertions, 6 deletions
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 (('<stdin>', 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: |