Improve logging when operations are successful.
This commit is contained in:
@@ -446,6 +446,8 @@ def delete_certificate(hostname, verify, username, password, certificates, certi
|
||||
logger.error('Impossible to delete certificate')
|
||||
sys.exit(-1)
|
||||
|
||||
logger.info('Certificate deleted with success.')
|
||||
|
||||
def main():
|
||||
"""
|
||||
Main entry point of the program.
|
||||
@@ -595,10 +597,14 @@ def main():
|
||||
certs = get_certificates(hostname=args.hostname, verify=args.verify,
|
||||
username=args.username,
|
||||
password=args.password)
|
||||
logger.info('List of certificates:')
|
||||
for certid, cert in certs.items():
|
||||
subject = cert.get('subject')
|
||||
issuer = cert.get('issuer')
|
||||
print(f'{certid} - {subject} issued by {issuer}.')
|
||||
validity = cert.get('validity')
|
||||
begin = parse(validity.get('fromDate'))
|
||||
end = parse(validity.get('toDate'))
|
||||
print(f'{certid} - {subject} issued by {issuer}. From: {begin} to {end}')
|
||||
case 'del':
|
||||
bearer = get_bearer(hostname=args.hostname, verify=args.verify, username=args.username,
|
||||
password=args.password)
|
||||
|
||||
Reference in New Issue
Block a user