MCPcopy Create free account
hub / github.com/adobe/Marinus / insert_certificate

Function insert_certificate

python3_cron_scripts/get_original_ct_logs.py:337–361  ·  view source on GitHub ↗

Insert or update the record in the database as needed.

(cert, source, ct_collection, cert_zones)

Source from the content-addressed store, hash-verified

335
336
337def insert_certificate(cert, source, ct_collection, cert_zones):
338 """
339 Insert or update the record in the database as needed.
340 """
341
342 if (
343 ct_collection.count_documents(
344 {"fingerprint_sha256": cert["fingerprint_sha256"]}
345 )
346 == 0
347 ):
348 ct_collection.insert_one(cert)
349 else:
350 ct_collection.update_many(
351 {"fingerprint_sha256": cert["fingerprint_sha256"]},
352 {
353 "$set": {
354 source + "_id": cert[source + "_id"],
355 "ct_log_type": cert["ct_log_type"],
356 "zones": cert_zones,
357 "marinus_updated": datetime.now(),
358 },
359 "$addToSet": {"sources": source},
360 },
361 )
362
363
364def write_file(logger, storage_manager, cert, save_location, save_type, source):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected