Files
charms.openstack/unit_tests/test_charms_openstack_charm.py
Alex Kavanagh 1e3095124e Change assess_status() method to be deferred and run once.
This change makes the assess_status() method to be deferred until the
end of the hook execution.  This is to ensure that the (expensive)
assess_status() functionality is only run once, even though it may be
called multiple times from reactive handlers that need to update the
status on the charm.

This uses the hookenv.atexit() function to queue an function that calls
_assess_status() on the charm singleton after all the reactive handlers
have run.  If no handler calls the assess_status() method then the
_assess_status() 'real' method won't be called for that hook invocation.

Change-Id: I5d405446761a646585dfa1c446009e4374c01000
2017-05-12 16:53:06 +01:00

68 KiB