amoghrajesh commented on code in PR #37214:
URL: https://github.com/apache/airflow/pull/37214#discussion_r1480908546
##########
airflow/providers/mongo/hooks/mongo.py:
##########
@@ -98,12 +101,13 @@ def get_conn(self) -> MongoClient:
# If we are using SSL disable requiring certs from specific hostname
if options.get("ssl", False):
+ allow_insecure = self.extras.get("allow_insecure", True)
if pymongo.__version__ >= "4.0.0":
- # In pymongo 4.0.0+ `tlsAllowInvalidCertificates=True`
- # replaces `ssl_cert_reqs=CERT_NONE`
- options.update({"tlsAllowInvalidCertificates": True})
+ # For pymongo 4.0.0+, use 'tlsAllowInvalidCertificates'
+ options["tlsAllowInvalidCertificates"] = allow_insecure
else:
- options.update({"ssl_cert_reqs": CERT_NONE})
+ # For older pymongo versions, use 'ssl_cert_reqs'
+ options["ssl_cert_reqs"] = None if allow_insecure else
CERT_NONE
Review Comment:
Is there any field in the connection that gets the certs from the hook?
Ideally that should be provided here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]