Make retcode the number of failed checks

This commit is contained in:
2022-10-10 07:22:11 +10:30
parent 4f04bd2a8c
commit 0566ed9878

View File

@@ -8,7 +8,6 @@ Options:
-t SECONDS --timeout=SECONDS Timeout for SSL Handshake [default: 5]
"""
import logging
from pprint import pprint
from docopt import docopt
@@ -30,7 +29,11 @@ if __name__ == "__main__":
logging.info(f"Getting CERT from {hs}")
results.append(check_host_certificate_expiration(hs, days_to_expiration))
failed = list(r for r in results if not r.check_successful)
if output_as_json:
print(json_output(results))
else:
print(default_output(results))
exit(len(failed))