From b125561e2580d289e0d297f455b748bcaa050dfa Mon Sep 17 00:00:00 2001 From: Jun Aishima Date: Wed, 6 Mar 2024 17:57:34 -0500 Subject: [PATCH 1/4] make args more consistent * --mongo_uri and --service_port for all --- conftrak/ignition.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conftrak/ignition.py b/conftrak/ignition.py index 9e5b766..3d10950 100644 --- a/conftrak/ignition.py +++ b/conftrak/ignition.py @@ -36,11 +36,11 @@ def parse_configuration(config=None): "--database", dest="database", type=str, help="name of database to use" ) parser.add_argument( - "--mongo-uri", dest="mongo_uri", type=str, help="URI to use to connect to Mongo" + "--mongo_uri", dest="mongo_uri", type=str, help="URI to use to connect to Mongo" ) parser.add_argument("--timezone", dest="timezone", type=str, help="Local timezone") parser.add_argument( - "--service-port", + "--service_port", dest="service_port", type=int, help="port listen to for clients", From 29b711eee66ffa8e6db5f921e882e89cfbf97e63 Mon Sep 17 00:00:00 2001 From: Jun Aishima Date: Wed, 6 Mar 2024 17:58:13 -0500 Subject: [PATCH 2/4] fix argument after update --- conftrak/test/test_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conftrak/test/test_server.py b/conftrak/test/test_server.py index 220c819..a800c52 100644 --- a/conftrak/test/test_server.py +++ b/conftrak/test/test_server.py @@ -13,7 +13,7 @@ def test_parse_configuration(): "prog", "--database", "conftrak", - "--mongo-uri", + "--mongo_uri", "mongodb://localhost", "--timezone", "US/Eastern", From bb4d1e376daaa573af138d6717542b9944e02df8 Mon Sep 17 00:00:00 2001 From: Jun Aishima Date: Wed, 6 Mar 2024 17:59:17 -0500 Subject: [PATCH 3/4] use a more-favored function call to check client connection * more questions online about checking status use server_info() than other functions on the mongo client --- conftrak/server/engine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conftrak/server/engine.py b/conftrak/server/engine.py index 0d1d561..5ce2007 100644 --- a/conftrak/server/engine.py +++ b/conftrak/server/engine.py @@ -33,7 +33,7 @@ def db_connect(database, mongo_uri, testing=False): else: try: client = pymongo.MongoClient(mongo_uri) - client.list_database_names() # check if the server is really okay. + client.server_info() # check if the server is really okay. except ( pymongo.errors.ConnectionFailure, pymongo.errors.ServerSelectionTimeoutError, From b5a84e92fa2e1841d49335a476a43ce74a315710 Mon Sep 17 00:00:00 2001 From: Jun Aishima Date: Thu, 7 Mar 2024 12:02:04 -0500 Subject: [PATCH 4/4] Update conftrak/server/engine.py Co-authored-by: Garrett Bischof --- conftrak/server/engine.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conftrak/server/engine.py b/conftrak/server/engine.py index 5ce2007..7288b60 100644 --- a/conftrak/server/engine.py +++ b/conftrak/server/engine.py @@ -33,7 +33,8 @@ def db_connect(database, mongo_uri, testing=False): else: try: client = pymongo.MongoClient(mongo_uri) - client.server_info() # check if the server is really okay. + # Proactively check that connection to server is working. + client.server_info() except ( pymongo.errors.ConnectionFailure, pymongo.errors.ServerSelectionTimeoutError,