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')
|
logger.error('Impossible to delete certificate')
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
|
logger.info('Certificate deleted with success.')
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""
|
"""
|
||||||
Main entry point of the program.
|
Main entry point of the program.
|
||||||
@@ -595,10 +597,14 @@ def main():
|
|||||||
certs = get_certificates(hostname=args.hostname, verify=args.verify,
|
certs = get_certificates(hostname=args.hostname, verify=args.verify,
|
||||||
username=args.username,
|
username=args.username,
|
||||||
password=args.password)
|
password=args.password)
|
||||||
|
logger.info('List of certificates:')
|
||||||
for certid, cert in certs.items():
|
for certid, cert in certs.items():
|
||||||
subject = cert.get('subject')
|
subject = cert.get('subject')
|
||||||
issuer = cert.get('issuer')
|
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':
|
case 'del':
|
||||||
bearer = get_bearer(hostname=args.hostname, verify=args.verify, username=args.username,
|
bearer = get_bearer(hostname=args.hostname, verify=args.verify, username=args.username,
|
||||||
password=args.password)
|
password=args.password)
|
||||||
|
|||||||
Reference in New Issue
Block a user