Update self._stored.is_started where required
OSBaseCharm() registers an "update-status" event callback, but does not
update its own self._stored.is_started flag. By default this flag is
False and when the event gets delivered, the callback sends the charm
into a WaitingStatus().
This change adds "is_started = True" in our CinderCharmBase().
The places where the flag is set to True are up for discussion.
Alternatively, the base update_status() can be overridden, setting the
flag there before calling super().update_status()
Change-Id: I65c4b7477163617bb700889d300b10f66fcba152
diff --git a/src/charm.py b/src/charm.py
index 98a5225..2e935f8 100755
--- a/src/charm.py
+++ b/src/charm.py
@@ -85,6 +85,8 @@
if conf_error is not None:
logger.error(conf_error)
self.unit.status = BlockedStatus(conf_error)
+ self._stored.is_started = False
+
return
self.create_storpool_conf(
@@ -95,10 +97,14 @@
super().on_config(event)
+ self._stored.is_started = True
+
def cinder_configuration(self, config):
conf_error = self._check_for_config_errors(config)
if conf_error is not None:
logger.error(conf_error)
+ self._stored.is_started = False
+
return []
# Return the configuration to be set by the principal.
@@ -128,6 +134,8 @@
)
)
+ self._stored.is_started = True
+
return options
@staticmethod