From 530cabd003f401e5599a1abc52777c5e69e43b7e Mon Sep 17 00:00:00 2001 From: Alex Dusenbery Date: Mon, 2 Mar 2020 14:16:32 -0500 Subject: [PATCH] Remove the auth_source kwarg in connect_to_mongodb, since we're now relying on authsource (no underscore) and the pymongo Database init does not expect and will not tolerate an auth_source kwarg. --- common/lib/xmodule/xmodule/mongo_utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/lib/xmodule/xmodule/mongo_utils.py b/common/lib/xmodule/xmodule/mongo_utils.py index d46e129a8f..76f476bd43 100644 --- a/common/lib/xmodule/xmodule/mongo_utils.py +++ b/common/lib/xmodule/xmodule/mongo_utils.py @@ -48,6 +48,11 @@ def connect_to_mongodb( # If the MongoDB server uses a separate authentication database that should be specified here auth_source = kwargs.get('authsource', '') or None + # sanitize a kwarg which may be present and is no longer expected + # AED 2020-03-02 TODO: Remove this when 'auth_source' will no longer exist in kwargs + if 'auth_source' in kwargs: + kwargs.pop('auth_source') + # If read_preference is given as a name of a valid ReadPreference. # constant such as "SECONDARY_PREFERRED" or a mongo mode such as # "secondaryPreferred", convert it. Otherwise pass it through unchanged.