1
0
mirror of https://github.com/moepman/acertmgr.git synced 2024-11-13 06:45:24 +01:00

Prevent failure when target file is missing

This commit is contained in:
David Klaftenegger 2016-04-04 23:35:43 +02:00 committed by Markus Hauschild
parent 6599c49476
commit dc83df8d97

View File

@ -37,6 +37,8 @@ class InvalidCertificateError(Exception):
# @param crt_file string containing the path to the certificate file
# @return True if target file is at least as new as the certificate, False otherwise
def target_isCurrent(target, crt_file):
if not os.path.isfile(target):
return False
target_date = os.path.getmtime(target)
crt_date = os.path.getmtime(crt_file)
return target_date >= crt_date