X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Fcharm%2Fosm-mon%2Fsrc%2Fcharm.py;fp=installers%2Fcharm%2Fosm-mon%2Fsrc%2Fcharm.py;h=e07d607297c57f5a25e285618ae9f0a29b4a3fd0;hb=6ce504a281a36bb3e775a06437abcbe519ae9df6;hp=176f896e415aeea861bd69dfcb3dc30ed654ca37;hpb=f0cb2ddc6c4e9ca6b9a2fb3b859ecea447878763;p=osm%2Fdevops.git diff --git a/installers/charm/osm-mon/src/charm.py b/installers/charm/osm-mon/src/charm.py index 176f896e..e07d6072 100755 --- a/installers/charm/osm-mon/src/charm.py +++ b/installers/charm/osm-mon/src/charm.py @@ -151,9 +151,7 @@ class OsmMonCharm(CharmBase): def _on_get_debug_mode_information_action(self, event: ActionEvent) -> None: """Handler for the get-debug-mode-information action event.""" if not self.debug_mode.started: - event.fail( - "debug-mode has not started. Hint: juju config mon debug-mode=true" - ) + event.fail("debug-mode has not started. Hint: juju config mon debug-mode=true") return debug_info = { @@ -179,13 +177,9 @@ class OsmMonCharm(CharmBase): # Action events self.on.get_debug_mode_information_action: self._on_get_debug_mode_information_action, } - for relation in [ - self.on[rel_name] for rel_name in ["mongodb", "prometheus", "keystone"] - ]: + for relation in [self.on[rel_name] for rel_name in ["mongodb", "prometheus", "keystone"]]: event_handler_mapping[relation.relation_changed] = self._on_config_changed - event_handler_mapping[ - relation.relation_broken - ] = self._on_required_relation_broken + event_handler_mapping[relation.relation_broken] = self._on_required_relation_broken for event, handler in event_handler_mapping.items(): self.framework.observe(event, handler) @@ -219,9 +213,7 @@ class OsmMonCharm(CharmBase): if missing_relations: relations_str = ", ".join(missing_relations) one_relation_missing = len(missing_relations) == 1 - error_msg = ( - f'need {relations_str} relation{"" if one_relation_missing else "s"}' - ) + error_msg = f'need {relations_str} relation{"" if one_relation_missing else "s"}' logger.warning(error_msg) raise CharmError(error_msg) @@ -236,9 +228,7 @@ class OsmMonCharm(CharmBase): environment = { # General configuration "OSMMON_GLOBAL_LOGLEVEL": self.config["log-level"], - "OSMMON_OPENSTACK_DEFAULT_GRANULARITY": self.config[ - "openstack-default-granularity" - ], + "OSMMON_OPENSTACK_DEFAULT_GRANULARITY": self.config["openstack-default-granularity"], "OSMMON_GLOBAL_REQUEST_TIMEOUT": self.config["global-request-timeout"], "OSMMON_COLLECTOR_INTERVAL": self.config["collector-interval"], "OSMMON_EVALUATOR_INTERVAL": self.config["evaluator-interval"],