Skip to content

Commit eba3c8f

Browse files
Avoid re-bootstrapping in workload's reconcile method
1 parent 6f4b271 commit eba3c8f

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

src/abstract_charm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def _substrate(self) -> str:
135135
"""Returns the substrate of the charm: vm or k8s"""
136136

137137
@abc.abstractmethod
138-
def is_exposed(self, relation=None) -> bool:
138+
def is_exposed(self, relation=None) -> typing.Optional[bool]:
139139
"""Whether router is exposed externally"""
140140

141141
def _cos_exporter_config(self, event) -> typing.Optional[relations.cos.ExporterConfig]:

src/machine_charm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def _tls_certificate(self) -> typing.Optional[str]:
100100
def _tls_certificate_authority(self) -> typing.Optional[str]:
101101
return self.tls.certificate_authority
102102

103-
def is_exposed(self, relation=None) -> bool:
103+
def is_exposed(self, relation=None) -> typing.Optional[bool]:
104104
return self._database_provides.is_exposed
105105

106106
def _reconcile_node_port(self, event) -> None:

src/workload.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,7 @@ def reconcile(
348348
# If the host or port changes, MySQL Router will receive topology change
349349
# notifications from MySQL.
350350
# Therefore, if the host or port changes, we do not need to restart MySQL Router.
351-
is_charm_exposed = self._charm.is_exposed()
352-
socket_file_exists = self._container.path("/run/mysqlrouter/mysql.sock").exists()
353-
require_rebootstrap = is_charm_exposed == socket_file_exists
354-
if not self._container.mysql_router_service_enabled or require_rebootstrap:
351+
if not self._container.mysql_router_service_enabled:
355352
logger.debug("Enabling MySQL Router service")
356353
self._cleanup_after_upgrade_or_potential_container_restart()
357354
# create an empty credentials file, if the file does not exist

0 commit comments

Comments
 (0)