Ensure endpoints are populated within actions
When actions are run the reactive run_at{start,exit} methods are not implicit run. This means that some data associated with endpoints is missing. For example reactive.Endpoint.all_joined_units is always None. Change-Id: I565fb534612a06d76e6688ed4f06ad64bc42e512
This commit is contained in:
parent
ba152d41b4
commit
207bac8bec
|
@ -23,6 +23,7 @@ from charms.layer import basic
|
||||||
basic.bootstrap_charm_deps()
|
basic.bootstrap_charm_deps()
|
||||||
|
|
||||||
import charmhelpers.core.hookenv as hookenv
|
import charmhelpers.core.hookenv as hookenv
|
||||||
|
import charmhelpers.core as ch_core
|
||||||
import charms_openstack.bus
|
import charms_openstack.bus
|
||||||
import charms_openstack.charm
|
import charms_openstack.charm
|
||||||
|
|
||||||
|
@ -63,6 +64,9 @@ ACTIONS = {
|
||||||
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
|
# Manually trigger any register atstart events to ensure all endpoints
|
||||||
|
# are correctly setup, Bug #1916008.
|
||||||
|
ch_core.hookenv._run_atstart()
|
||||||
action_name = os.path.basename(args[0])
|
action_name = os.path.basename(args[0])
|
||||||
try:
|
try:
|
||||||
action = ACTIONS[action_name]
|
action = ACTIONS[action_name]
|
||||||
|
@ -73,6 +77,7 @@ def main(args):
|
||||||
action(args)
|
action(args)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
hookenv.action_fail(str(e))
|
hookenv.action_fail(str(e))
|
||||||
|
ch_core.hookenv._run_atexit()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue