From 1df358627a7cce44951b30541e20a314781ac80f Mon Sep 17 00:00:00 2001 From: Ashley James Date: Thu, 21 Mar 2024 19:05:31 +0530 Subject: [PATCH] Move exporter installed check to top of update status --- src/charm.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/charm.py b/src/charm.py index 472bc11a..862d346c 100755 --- a/src/charm.py +++ b/src/charm.py @@ -125,6 +125,10 @@ def _on_update_status(self, _: EventBase) -> None: # noqa: C901 # The charm should be in BlockedStatus with install failed msg return # type: ignore[unreachable] + if not self._stored.exporter_installed: # type: ignore[truthy-function] + # The charm should be in BlockedStatus with exporter install failed msg + return # type: ignore[unreachable] + config_valid, config_valid_message = self.validate_exporter_configs() if not config_valid: self.model.unit.status = BlockedStatus(config_valid_message) @@ -143,10 +147,6 @@ def _on_update_status(self, _: EventBase) -> None: # noqa: C901 self.model.unit.status = BlockedStatus(error_msg) return - if not self._stored.exporter_installed: # type: ignore[truthy-function] - logger.warning("Exporter not installed") # type: ignore[unreachable] - return - if not self.exporter.check_health(): logger.warning("Exporter health check - failed.") # if restart isn't successful, an ExporterError exception will be raised here