Browse Source

Support charms without pause/resume actions

Change-Id: Idc3435743105af3e4d702e73d59d7b141afd2d26
changes/90/795090/1
Liam Young 12 months ago
parent
commit
2057e90e46
  1. 16
      ops_openstack/core.py

16
ops_openstack/core.py

@ -72,8 +72,20 @@ class OSBaseCharm(CharmBase):
self._stored.set_default(series_upgrade=False)
self.framework.observe(self.on.install, self.on_install)
self.framework.observe(self.on.update_status, self.on_update_status)
self.framework.observe(self.on.pause_action, self.on_pause_action)
self.framework.observe(self.on.resume_action, self.on_resume_action)
# A charm may not have pause/resume actions if it does not manage a
# daemon.
try:
self.framework.observe(
self.on.pause_action,
self.on_pause_action)
except AttributeError:
pass
try:
self.framework.observe(
self.on.resume_action,
self.on_resume_action)
except AttributeError:
pass
self.framework.observe(self.on.pre_series_upgrade,
self.on_pre_series_upgrade)
self.framework.observe(self.on.post_series_upgrade,

Loading…
Cancel
Save