From c4d2605a5f0fcc1de0e6dc1758a33c00fe2e44e3 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 19 Sep 2024 12:57:37 -0500 Subject: [PATCH] pants-plugins/uses_services: use mongo ping instead of deprecated ismaster This matches the method used in st2common.models.db --- pants-plugins/uses_services/scripts/is_mongo_running.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pants-plugins/uses_services/scripts/is_mongo_running.py b/pants-plugins/uses_services/scripts/is_mongo_running.py index 637fc9ac1c..6ce2e54eb2 100644 --- a/pants-plugins/uses_services/scripts/is_mongo_running.py +++ b/pants-plugins/uses_services/scripts/is_mongo_running.py @@ -38,8 +38,9 @@ def _is_mongo_running( # connection.connect() is lazy. Make a command to test the connection. try: - # The ismaster command is cheap and does not require auth - connection.admin.command("ismaster") + # 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): return False return True