Move from decorator to new format for workload status
This commit is contained in:
parent
32ec1cb6a6
commit
7deaffa795
|
@ -22,7 +22,7 @@ from charmhelpers.core.host import (
|
||||||
|
|
||||||
from charmhelpers.contrib.openstack.utils import (
|
from charmhelpers.contrib.openstack.utils import (
|
||||||
os_requires_version,
|
os_requires_version,
|
||||||
os_workload_status,
|
set_os_workload_status,
|
||||||
)
|
)
|
||||||
|
|
||||||
from neutron_ovs_utils import (
|
from neutron_ovs_utils import (
|
||||||
|
@ -55,8 +55,6 @@ def install():
|
||||||
|
|
||||||
@hooks.hook('neutron-plugin-relation-changed')
|
@hooks.hook('neutron-plugin-relation-changed')
|
||||||
@hooks.hook('config-changed')
|
@hooks.hook('config-changed')
|
||||||
@os_workload_status(CONFIGS, REQUIRED_INTERFACES,
|
|
||||||
charm_func=check_optional_relations)
|
|
||||||
@restart_on_change(restart_map())
|
@restart_on_change(restart_map())
|
||||||
def config_changed():
|
def config_changed():
|
||||||
install_packages()
|
install_packages()
|
||||||
|
@ -73,8 +71,6 @@ def config_changed():
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('neutron-plugin-api-relation-changed')
|
@hooks.hook('neutron-plugin-api-relation-changed')
|
||||||
@os_workload_status(CONFIGS, REQUIRED_INTERFACES,
|
|
||||||
charm_func=check_optional_relations)
|
|
||||||
@restart_on_change(restart_map())
|
@restart_on_change(restart_map())
|
||||||
def neutron_plugin_api_changed():
|
def neutron_plugin_api_changed():
|
||||||
if use_dvr():
|
if use_dvr():
|
||||||
|
@ -89,8 +85,6 @@ def neutron_plugin_api_changed():
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('neutron-plugin-relation-joined')
|
@hooks.hook('neutron-plugin-relation-joined')
|
||||||
@os_workload_status(CONFIGS, REQUIRED_INTERFACES,
|
|
||||||
charm_func=check_optional_relations)
|
|
||||||
def neutron_plugin_joined(relation_id=None):
|
def neutron_plugin_joined(relation_id=None):
|
||||||
if enable_local_dhcp():
|
if enable_local_dhcp():
|
||||||
install_packages()
|
install_packages()
|
||||||
|
@ -104,8 +98,6 @@ def neutron_plugin_joined(relation_id=None):
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('amqp-relation-joined')
|
@hooks.hook('amqp-relation-joined')
|
||||||
@os_workload_status(CONFIGS, REQUIRED_INTERFACES,
|
|
||||||
charm_func=check_optional_relations)
|
|
||||||
def amqp_joined(relation_id=None):
|
def amqp_joined(relation_id=None):
|
||||||
relation_set(relation_id=relation_id,
|
relation_set(relation_id=relation_id,
|
||||||
username=config('rabbit-user'),
|
username=config('rabbit-user'),
|
||||||
|
@ -114,8 +106,6 @@ def amqp_joined(relation_id=None):
|
||||||
|
|
||||||
@hooks.hook('amqp-relation-changed')
|
@hooks.hook('amqp-relation-changed')
|
||||||
@hooks.hook('amqp-relation-departed')
|
@hooks.hook('amqp-relation-departed')
|
||||||
@os_workload_status(CONFIGS, REQUIRED_INTERFACES,
|
|
||||||
charm_func=check_optional_relations)
|
|
||||||
@restart_on_change(restart_map())
|
@restart_on_change(restart_map())
|
||||||
def amqp_changed():
|
def amqp_changed():
|
||||||
if 'amqp' not in CONFIGS.complete_contexts():
|
if 'amqp' not in CONFIGS.complete_contexts():
|
||||||
|
@ -125,8 +115,6 @@ def amqp_changed():
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('zeromq-configuration-relation-joined')
|
@hooks.hook('zeromq-configuration-relation-joined')
|
||||||
@os_workload_status(CONFIGS, REQUIRED_INTERFACES,
|
|
||||||
charm_func=check_optional_relations)
|
|
||||||
@os_requires_version('kilo', 'neutron-common')
|
@os_requires_version('kilo', 'neutron-common')
|
||||||
def zeromq_configuration_relation_joined(relid=None):
|
def zeromq_configuration_relation_joined(relid=None):
|
||||||
relation_set(relation_id=relid,
|
relation_set(relation_id=relid,
|
||||||
|
@ -135,8 +123,6 @@ def zeromq_configuration_relation_joined(relid=None):
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('zeromq-configuration-relation-changed')
|
@hooks.hook('zeromq-configuration-relation-changed')
|
||||||
@os_workload_status(CONFIGS, REQUIRED_INTERFACES,
|
|
||||||
charm_func=check_optional_relations)
|
|
||||||
@restart_on_change(restart_map(), stopstart=True)
|
@restart_on_change(restart_map(), stopstart=True)
|
||||||
def zeromq_configuration_relation_changed():
|
def zeromq_configuration_relation_changed():
|
||||||
CONFIGS.write_all()
|
CONFIGS.write_all()
|
||||||
|
@ -147,6 +133,8 @@ def main():
|
||||||
hooks.execute(sys.argv)
|
hooks.execute(sys.argv)
|
||||||
except UnregisteredHookError as e:
|
except UnregisteredHookError as e:
|
||||||
log('Unknown hook {} - skipping.'.format(e))
|
log('Unknown hook {} - skipping.'.format(e))
|
||||||
|
set_os_workload_status(CONFIGS, REQUIRED_INTERFACES,
|
||||||
|
charm_func=check_optional_relations)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue