From 9b87aae38a9a58452b1b11e5b2baa684480022c9 Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Fri, 15 Jul 2016 14:55:20 +0000 Subject: [PATCH] Add assess_status() to base layer as part of workload status This bakes in the assess_status() to the update-status hook to call assess_status() on the charms_openstack.charm.OpenStackCharm class. This has the effect of determining the workload status for the unit. Change-Id: Idf9a712f818445ba9f68dccae2d98237eb7f7eee --- reactive/charms_openstack_handlers.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 reactive/charms_openstack_handlers.py diff --git a/reactive/charms_openstack_handlers.py b/reactive/charms_openstack_handlers.py new file mode 100644 index 0000000..66f7a66 --- /dev/null +++ b/reactive/charms_openstack_handlers.py @@ -0,0 +1,22 @@ +# handle the update-status hook for all openstack charms + +from __future__ import absolute_import + +import charms.reactive as reactive +import charmhelpers.core.hookenv as hookenv + +import charms_openstack.charm as charm + + +@reactive.hook('update-status') +def update_status(): + """Use the update-status hook to run the assess_status() function for the + unit. + + This runs, via the singleton, the assess_status() on the derived class, + which is auto-instantiated according the the release. + + To deactivate this function override the assess_status in the derived class + to a NOP. + """ + charm.OpenStackCharm.singleton.assess_status()