From d8c64f73550d0c2d6cc90f6e38e58da4b3c2b2b5 Mon Sep 17 00:00:00 2001 From: Eugen Cusmaunsa Date: Mon, 23 Aug 2021 21:38:09 +0100 Subject: [PATCH 1/2] Avoid mongodb compatibility regression by using 'ping' instead of 'hello' command A follow-up to https://github.com/StackStorm/st2/pull/5302 See https://www.mongodb.com/community/forums/t/how-to-use-the-new-hello-interface-for-availability/116748/ --- st2common/st2common/models/db/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/st2common/st2common/models/db/__init__.py b/st2common/st2common/models/db/__init__.py index fe21aa0a6b..5e25bf4a19 100644 --- a/st2common/st2common/models/db/__init__.py +++ b/st2common/st2common/models/db/__init__.py @@ -199,9 +199,9 @@ def _db_connect( # successfully established. # See http://api.mongodb.com/python/current/api/pymongo/mongo_client.html for details try: - # The hello command is cheap and does not require auth - # https://docs.mongodb.com/v4.4/reference/command/hello/ - connection.admin.command("hello") + # The ping command is cheap and does not require auth + # https://www.mongodb.com/community/forums/t/how-to-use-the-new-hello-interface-for-availability/116748/ + connection.admin.command("ping") 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 From 29856487c23d5cef36b1d2ac2ccc784692333a80 Mon Sep 17 00:00:00 2001 From: Eugen Cusmaunsa Date: Mon, 23 Aug 2021 21:45:06 +0100 Subject: [PATCH 2/2] Update the changelog --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 51ac8104ca..877f8d40fa 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -29,7 +29,7 @@ Changed Contributed by @ericreeves. -* update db connect mongo connection test - `isMaster` MongoDB command depreciated, switch to `hello` #5302 +* update db connect mongo connection test - `isMaster` MongoDB command depreciated, switch to `ping` #5302, #5341 Contributed by @lukepatrick