Skip to content

Commit

Permalink
Merge pull request #5302 from lukepatrick/master
Browse files Browse the repository at this point in the history
update db connect mongo connection test
  • Loading branch information
arm4b authored Aug 19, 2021
2 parents 396a8a8 + 19de351 commit 71cb10f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ Changed

Contributed by @ericreeves.

* update db connect mongo connection test - `isMaster` MongoDB command depreciated, switch to `hello` #5302

Contributed by @lukepatrick

3.5.0 - June 23, 2021
---------------------

Expand Down
5 changes: 3 additions & 2 deletions st2common/st2common/models/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@ def _db_connect(
# successfully established.
# See http://api.mongodb.com/python/current/api/pymongo/mongo_client.html for details
try:
# The ismaster command is cheap and does not require auth
connection.admin.command("ismaster")
# The hello command is cheap and does not require auth
# https://docs.mongodb.com/v4.4/reference/command/hello/
connection.admin.command("hello")
except (ConnectionFailure, ServerSelectionTimeoutError) as e:
# NOTE: ServerSelectionTimeoutError can also be thrown if SSLHandShake fails in the server
# Sadly the client doesn't include more information about the error so in such scenarios
Expand Down

0 comments on commit 71cb10f

Please sign in to comment.