Removed commented log lines

Added logging of number of downloaded certificates
This commit is contained in:
sirferl 2020-12-03 08:30:54 +01:00
parent a0517d26fa
commit f0f13ce97b
1 changed files with 3 additions and 3 deletions

View File

@ -355,6 +355,7 @@ class EntrustSourcePlugin(SourcePlugin):
get_url = f"{base_url}/certificates" get_url = f"{base_url}/certificates"
certs = [] certs = []
processed_certs = 0
offset = 0 offset = 0
while True: while True:
response = self.session.get(get_url, response = self.session.get(get_url,
@ -373,14 +374,12 @@ class EntrustSourcePlugin(SourcePlugin):
status_code = response.status_code status_code = response.status_code
if status_code > 399: if status_code > 399:
raise Exception(f"ENTRUST error: {status_code}\n{data['errors']}") raise Exception(f"ENTRUST error: {status_code}\n{data['errors']}")
# current_app.logger.info(f"recevied: {data['summary']}")
for c in data["certificates"]: for c in data["certificates"]:
download_url = "{0}{1}".format( download_url = "{0}{1}".format(
host, c["uri"] host, c["uri"]
) )
cert_response = self.session.get(download_url) cert_response = self.session.get(download_url)
certificate = json.loads(cert_response.content) certificate = json.loads(cert_response.content)
# current_app.logger.info(f"Result: {certificate}")
# normalize serial # normalize serial
serial = str(int(certificate["serialNumber"], 16)) serial = str(int(certificate["serialNumber"], 16))
cert = { cert = {
@ -389,11 +388,12 @@ class EntrustSourcePlugin(SourcePlugin):
"external_id": str(certificate["trackingId"]), "external_id": str(certificate["trackingId"]),
} }
certs.append(cert) certs.append(cert)
processed_certs += 1
if data["summary"]["limit"] * offset >= data["summary"]["total"]: if data["summary"]["limit"] * offset >= data["summary"]["total"]:
break break
else: else:
offset += 1 offset += 1
current_app.logger.info(f"Result: {certs}") current_app.logger.info(f"Retrieved {processed_certs} ertificates")
return certs return certs
def get_endpoints(self, options, **kwargs): def get_endpoints(self, options, **kwargs):