- def on_mysql_relation_changed(self, event):
- unit = self.model.unit
- if not unit.is_leader():
- return
- unit_data = event.relation.data[event.unit]
- self.state.mysql_host = unit_data.get("host")
- self.state.mysql_port = unit_data.get("port")
- self.state.mysql_root_password = unit_data.get("root_password")
- self.state.mysql_database = self.model.config["database"]
- self._apply_spec()
-