PGP Keyring: Display expiry dates in ISO format
This commit is contained in:
parent
570a22903a
commit
e519cea350
2 changed files with 8 additions and 8 deletions
|
@ -31,7 +31,7 @@ def key_representation(key):
|
|||
"auth": skey.can_authenticate == 1,
|
||||
"fpr": skey.fpr,
|
||||
"expires": skey.expires if skey.expires != 0 else None,
|
||||
"expires_date": datetime.datetime.utcfromtimestamp(skey.expires).strftime("%x") if skey.expires != 0 else None,
|
||||
"expires_date": datetime.datetime.utcfromtimestamp(skey.expires).date().isoformat() if skey.expires != 0 else None,
|
||||
"expires_days": (datetime.datetime.utcfromtimestamp(skey.expires) - now).days if skey.expires != 0 else None,
|
||||
"expired": skey.expired == 1,
|
||||
"algorithm": gpg.core.pubkey_algo_name(skey.pubkey_algo),
|
||||
|
|
|
@ -290,9 +290,9 @@ def run_pgp_checks(env, output):
|
|||
else:
|
||||
exp = datetime.datetime.utcfromtimestamp(sk.expires) # Our daemon key only has one subkey
|
||||
if (exp - now).days < 10 and sk.expires != 0:
|
||||
output.print_warning(f"The daemon's key ({k.fpr}) will expire soon, in {(exp - now).days} days on {exp.strftime('%x')}.")
|
||||
output.print_warning(f"The daemon's key ({k.fpr}) will expire soon, in {(exp - now).days} days on {exp.date().soformat()}.")
|
||||
else:
|
||||
output.print_ok(f"The daemon's key ({k.fpr}) is good. It expires in {(exp - now).days} days on {exp.strftime('%x')}.")
|
||||
output.print_ok(f"The daemon's key ({k.fpr}) is good. It expires in {(exp - now).days} days on {exp.date().isoformat()}.")
|
||||
|
||||
# Check imported keys
|
||||
keys = get_imported_keys()
|
||||
|
|
Loading…
Reference in a new issue