From 1400e3067dc05d5f1349e0b3ce16331e2ebde454 Mon Sep 17 00:00:00 2001 From: MiaAltieri Date: Mon, 11 Mar 2024 10:28:07 +0000 Subject: [PATCH] small fixes to pr request changes --- lib/charms/mongodb/v1/helpers.py | 2 +- lib/charms/mongodb/v1/shards_interface.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/charms/mongodb/v1/helpers.py b/lib/charms/mongodb/v1/helpers.py index d07aff9d9..16ce2e538 100644 --- a/lib/charms/mongodb/v1/helpers.py +++ b/lib/charms/mongodb/v1/helpers.py @@ -150,7 +150,7 @@ def get_mongos_args( cmd.extend( [ "--clusterAuthMode=keyFile", - f"--keyFile={KEY_FILE}", + f"--keyFile={full_conf_dir}/{KEY_FILE}", ] ) diff --git a/lib/charms/mongodb/v1/shards_interface.py b/lib/charms/mongodb/v1/shards_interface.py index 552183130..5431b4dff 100644 --- a/lib/charms/mongodb/v1/shards_interface.py +++ b/lib/charms/mongodb/v1/shards_interface.py @@ -464,8 +464,8 @@ def cluster_password_synced(self) -> bool: return False raise except ServerSelectionTimeoutError as e: - # Connection refused, - this occurs when internal membership via TLS is not in sync - # across the cluster. + # Connection refused, - this occurs when internal membership is not in sync across the + # cluster (i.e. TLS + KeyFile). if e.code == 111: return False raise @@ -952,6 +952,12 @@ def _is_added_to_cluster(self) -> bool: return False raise + except ServerSelectionTimeoutError as e: + # Connection refused, - this occurs when internal membership is not in sync across the + # cluster (i.e. TLS + KeyFile). + if e.code == 111: + return False + raise def cluster_password_synced(self) -> bool: """Returns True if the cluster password is synced for the shard.""" @@ -973,8 +979,8 @@ def cluster_password_synced(self) -> bool: return False raise except ServerSelectionTimeoutError as e: - # Connection refused, - this occurs when internal membership via TLS is not in sync - # across the cluster. + # Connection refused, - this occurs when internal membership is not in sync across the + # cluster (i.e. TLS + KeyFile). if e.code == 111: return False raise