From c26b13eb157e4b3f5a86d2c55fed0f13f3372b07 Mon Sep 17 00:00:00 2001 From: Hemanth Nakkina Date: Sat, 20 Apr 2024 13:03:01 +0530 Subject: [PATCH] [octavia] change ownership of octavia agent socket dir Currently the agent socket dir is owned by root. Change the ownership to octavia:octavia Change-Id: I96355b78049e882cf4852f8c56a7317440ab5cd2 --- charms/octavia-k8s/src/charm.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/charms/octavia-k8s/src/charm.py b/charms/octavia-k8s/src/charm.py index e24be0dc..cadb6c9e 100755 --- a/charms/octavia-k8s/src/charm.py +++ b/charms/octavia-k8s/src/charm.py @@ -44,6 +44,7 @@ logger = logging.getLogger(__name__) OCTAVIA_API_CONTAINER = "octavia-api" OCTAVIA_DRIVER_AGENT_CONTAINER = "octavia-driver-agent" OCTAVIA_HOUSEKEEPING_CONTAINER = "octavia-housekeeping" +OCTAVIA_AGENT_SOCKET_DIR = "/var/run/octavia" class OctaviaDriverAgentPebbleHandler(sunbeam_chandlers.ServicePebbleHandler): @@ -373,6 +374,29 @@ class OctaviaOVNOperatorCharm(OctaviaOperatorCharm): ) return cc_configs + def configure_unit(self, event: ops.EventBase) -> None: + """Run configuration on this unit.""" + self.check_leader_ready() + self.check_relation_handlers_ready(event) + self.open_ports() + self.init_container_services() + self.check_pebble_handlers_ready() + for container in [ + OCTAVIA_API_CONTAINER, + OCTAVIA_DRIVER_AGENT_CONTAINER, + ]: + ph = self.get_named_pebble_handler(container) + ph.execute( + [ + "chown", + f"{self.service_user}:{self.service_group}", + OCTAVIA_AGENT_SOCKET_DIR, + ] + ) + + self.run_db_sync() + self._state.unit_bootstrapped = True + if __name__ == "__main__": main(OctaviaOVNOperatorCharm)