From cf11703556001df8ddb87ba5cdcbe8445876861e Mon Sep 17 00:00:00 2001 From: Mia Altieri <32723809+MiaAltieri@users.noreply.github.com> Date: Thu, 3 Oct 2024 15:44:29 +0200 Subject: [PATCH 1/3] Fix incorrect Adding shard to config-server status (#497) Co-authored-by: Neha Oudin <17551419+Gu1nness@users.noreply.github.com> --- lib/charms/mongodb/v1/shards_interface.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/charms/mongodb/v1/shards_interface.py b/lib/charms/mongodb/v1/shards_interface.py index 9be6c8a41..ae6f9e8f1 100644 --- a/lib/charms/mongodb/v1/shards_interface.py +++ b/lib/charms/mongodb/v1/shards_interface.py @@ -58,7 +58,7 @@ # Increment this PATCH version before using `charmcraft publish-lib` or reset # to 0 if you are raising the major API version -LIBPATCH = 10 +LIBPATCH = 11 KEYFILE_KEY = "key-file" HOSTS_KEY = "host" @@ -557,7 +557,7 @@ def __init__( super().__init__(charm, self.relation_name) self.framework.observe( - charm.on[self.relation_name].relation_joined, self._on_relation_joined + charm.on[self.relation_name].relation_created, self.relation_created ) self.framework.observe( charm.on[self.relation_name].relation_changed, self._on_relation_changed @@ -687,7 +687,7 @@ def sync_cluster_passwords( # after updating the password of the backup user, restart pbm with correct password self.charm._connect_pbm_agent() - def _on_relation_joined(self, event: RelationJoinedEvent): + def relation_created(self, event: RelationJoinedEvent): """Sets status and flags in relation data relevant to sharding.""" # if re-using an old shard, re-set flags. self.charm.unit_peer_data["drained"] = json.dumps(False) From a49f4dfedf509a0c19d5ee50ab2f84a811e1e6a8 Mon Sep 17 00:00:00 2001 From: Mia Altieri <32723809+MiaAltieri@users.noreply.github.com> Date: Thu, 3 Oct 2024 15:45:13 +0200 Subject: [PATCH 2/3] fix: clients need to be able to read + write to socket file (#496) Co-authored-by: Neha Oudin <17551419+Gu1nness@users.noreply.github.com> --- lib/charms/mongodb/v1/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/charms/mongodb/v1/helpers.py b/lib/charms/mongodb/v1/helpers.py index 8567b119d..c4703d5a5 100644 --- a/lib/charms/mongodb/v1/helpers.py +++ b/lib/charms/mongodb/v1/helpers.py @@ -23,7 +23,7 @@ # Increment this PATCH version before using `charmcraft publish-lib` or reset # to 0 if you are raising the major API version -LIBPATCH = 11 +LIBPATCH = 12 # path to store mongodb ketFile KEY_FILE = "keyFile" @@ -118,7 +118,7 @@ def get_mongos_args( binding_ips = ( "--bind_ip_all" if external_connectivity - else f"--bind_ip {MONGODB_COMMON_DIR}/var/mongodb-27018.sock --filePermissions 755" + else f"--bind_ip {MONGODB_COMMON_DIR}/var/mongodb-27018.sock --filePermissions 0766" ) # mongos running on the config server communicates through localhost From 0a16ca2df29c3b156847c72491579c5b75869b50 Mon Sep 17 00:00:00 2001 From: Mia Altieri <32723809+MiaAltieri@users.noreply.github.com> Date: Thu, 3 Oct 2024 15:48:18 +0200 Subject: [PATCH 3/3] bump snap to handle issues with perms in mongosh (#498) ## Issue This PR bumps the snap revision to the latest to fix the permission issues on mongosh --------- Co-authored-by: Neha Oudin Co-authored-by: Neha Oudin <17551419+Gu1nness@users.noreply.github.com> --- lib/charms/mongodb/v1/helpers.py | 4 ++-- src/config.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/charms/mongodb/v1/helpers.py b/lib/charms/mongodb/v1/helpers.py index c4703d5a5..1b2f10649 100644 --- a/lib/charms/mongodb/v1/helpers.py +++ b/lib/charms/mongodb/v1/helpers.py @@ -89,7 +89,7 @@ def get_create_user_cmd(config: MongoConfiguration, mongo_path=MONGO_SHELL) -> L "mongodb://localhost/admin", "--quiet", "--eval", - "db.createUser({" + '"db.createUser({' f" user: '{config.username}'," " pwd: passwordPrompt()," " roles:[" @@ -99,7 +99,7 @@ def get_create_user_cmd(config: MongoConfiguration, mongo_path=MONGO_SHELL) -> L " ]," " mechanisms: ['SCRAM-SHA-256']," " passwordDigestor: 'server'," - "})", + '})"', ] diff --git a/src/config.py b/src/config.py index 4b32f847e..b394049a0 100644 --- a/src/config.py +++ b/src/config.py @@ -22,7 +22,7 @@ class Config: MONGOD_CONF_DIR = f"{MONGODB_SNAP_DATA_DIR}/etc/mongod" MONGOD_CONF_FILE_PATH = f"{MONGOD_CONF_DIR}/mongod.conf" CHARM_INTERNAL_VERSION_FILE = "charm_internal_version" - SNAP_PACKAGES = [("charmed-mongodb", "6/edge", 121)] + SNAP_PACKAGES = [("charmed-mongodb", "6/edge", 123)] MONGODB_COMMON_PATH = Path("/var/snap/charmed-mongodb/common")