From fda1af255d1cffeafdb1656d82fc3be897150ad3 Mon Sep 17 00:00:00 2001 From: Joseph Phillips Date: Fri, 15 Mar 2024 11:47:19 +0100 Subject: [PATCH] Updates the controller configuration file name from agent.conf to controller.conf. This is because on K8s, the agent's configuration is in in the controller-n path instead of machine-n on metal/VMs. We must use a different file name, or we overwrite the agent configuration. --- src/charm.py | 2 +- tests/test_charm.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/charm.py b/src/charm.py index cbb1aea..3c0c469 100755 --- a/src/charm.py +++ b/src/charm.py @@ -262,7 +262,7 @@ def _controller_config_path(self) -> str: the local controller ID, then use it to construct a config path. """ controller_id = self._config_change_socket.get_controller_agent_id() - return f'/var/lib/juju/agents/controller-{controller_id}/agent.conf' + return f'/var/lib/juju/agents/controller-{controller_id}/controller.conf' def _request_config_reload(self): """Send a reload request to the config reload socket""" diff --git a/tests/test_charm.py b/tests/test_charm.py index c178200..58caf57 100644 --- a/tests/test_charm.py +++ b/tests/test_charm.py @@ -214,7 +214,7 @@ def test_dbcluster_relation_changed_write_file( self.harness.update_relation_data( relation_id, harness.charm.app.name, {'db-bind-addresses': json.dumps(bound)}) - file_path = '/var/lib/juju/agents/controller-0/agent.conf' + file_path = '/var/lib/juju/agents/controller-0/controller.conf' self.assertEqual(mock_open.call_count, 2) # First call to read out the YAML