diff --git a/lib/charms/mongodb/v1/helpers.py b/lib/charms/mongodb/v1/helpers.py index 806c0ed2f..51a14e4d3 100644 --- a/lib/charms/mongodb/v1/helpers.py +++ b/lib/charms/mongodb/v1/helpers.py @@ -132,7 +132,7 @@ def get_mongod_args( full_conf_dir = f"{MONGODB_SNAP_DATA_DIR}{CONF_DIR}" if snap_install else CONF_DIR # in k8s the default logging options that are used for the vm charm are ignored and logs are # the output of the container. To enable logging to a file it must be set explicitly - logging_options = "" if snap_install else f"--logpath={full_data_dir}/{MONGODB_LOG_FILENAME}" + logging_options = f"--logpath={full_data_dir}/{MONGODB_LOG_FILENAME}" if snap_install else "" cmd = [ # bind to localhost and external interfaces "--bind_ip_all", diff --git a/tests/unit/test_mongodb_helpers.py b/tests/unit/test_mongodb_helpers.py index 4c5bd675c..89ed04e6c 100644 --- a/tests/unit/test_mongodb_helpers.py +++ b/tests/unit/test_mongodb_helpers.py @@ -17,6 +17,7 @@ def test_get_mongod_args(self): "--auditDestination=file", "--auditFormat=JSON", "--auditPath=/var/snap/charmed-mongodb/common/var/lib/mongodb/audit.json", + "--logpath=/var/snap/charmed-mongodb/common/var/lib/mongodb/mongodb.log", "--auth", "--clusterAuthMode=keyFile", "--keyFile=/var/snap/charmed-mongodb/current/etc/mongod/keyFile", @@ -42,6 +43,7 @@ def test_get_mongod_args(self): "--auditDestination=file", "--auditFormat=JSON", "--auditPath=/var/snap/charmed-mongodb/common/var/lib/mongodb/audit.json", + "--logpath=/var/snap/charmed-mongodb/common/var/lib/mongodb/mongodb.log", ] self.assertEqual( @@ -59,7 +61,6 @@ def test_get_mongod_args(self): "--auditDestination=file", "--auditFormat=JSON", "--auditPath=/var/lib/mongodb/audit.json", - "--logpath=/var/lib/mongodb/mongodb.log", ] self.assertEqual(