本文整理汇总了Python中charms.reactive.set_state方法的典型用法代码示例。如果您正苦于以下问题:Python reactive.set_state方法的具体用法?Python reactive.set_state怎么用?Python reactive.set_state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类charms.reactive
的用法示例。
在下文中一共展示了reactive.set_state方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render_config
# 需要导入模块: from charms import reactive [as 别名]
# 或者: from charms.reactive import set_state [as 别名]
def render_config(*args):
"""Render the configuration for charm when all the interfaces are
available.
"""
with charm.provide_charm_instance() as charm_class:
charm_class.render_with_interfaces(args)
charm_class.assess_status()
reactive.set_state('config.rendered')
# db_sync checks if sync has been done so rerunning is a noop
示例2: render_config
# 需要导入模块: from charms import reactive [as 别名]
# 或者: from charms.reactive import set_state [as 别名]
def render_config(*args):
"""Render the configuration for charm when all the interfaces are
available.
"""
with charm.provide_charm_instance() as charm_class:
charm_class.upgrade_if_available(args)
charm_class.enable_services()
charm_class.render_with_interfaces(args)
charm_class.enable_webserver_site()
charm_class.assess_status()
reactive.set_state('config.rendered')
# db_sync checks if sync has been done so rerunning is a noop
示例3: render_stuff
# 需要导入模块: from charms import reactive [as 别名]
# 或者: from charms.reactive import set_state [as 别名]
def render_stuff(*args):
# Get the optional hsm relation, if it is available for rendering.
trove.render_configs(args)
reactive.set_state('config.complete')
trove.assess_status()
示例4: run_db_migration
# 需要导入模块: from charms import reactive [as 别名]
# 或者: from charms.reactive import set_state [as 别名]
def run_db_migration():
trove.db_sync()
trove.restart_all()
reactive.set_state('db.synced')
trove.assess_status()
示例5: configure_domain_name
# 需要导入模块: from charms import reactive [as 别名]
# 或者: from charms.reactive import set_state [as 别名]
def configure_domain_name(domain):
keystone_ldap.render_config(domain.trigger_restart)
domain.domain_name(hookenv.config('domain-name') or
hookenv.service_name())
reactive.set_state('domain-name-configured')
示例6: check_configuration
# 需要导入模块: from charms import reactive [as 别名]
# 或者: from charms.reactive import set_state [as 别名]
def check_configuration():
'''Validate required configuration options at set state'''
if keystone_ldap.configuration_complete():
reactive.set_state('config.complete')
else:
reactive.remove_state('config.complete')
keystone_ldap.assess_status()
示例7: configure_openvswitch
# 需要导入模块: from charms import reactive [as 别名]
# 或者: from charms.reactive import set_state [as 别名]
def configure_openvswitch(odl_ovsdb):
with charm.provide_charm_instance() as ovs_odl_charm:
ovs_odl_charm.configure_openvswitch(odl_ovsdb)
reactive.set_state('ovs.configured')
示例8: default_install
# 需要导入模块: from charms import reactive [as 别名]
# 或者: from charms.reactive import set_state [as 别名]
def default_install():
"""Provide a default install handler
The instance automagically becomes the derived OpenStackCharm instance.
The kv() key charmers.openstack-release-version' is used to cache the
release being used for this charm. It is determined by the
default_select_release() function below, unless this is overriden by
the charm author
"""
unitdata.kv().unset(defaults.OPENSTACK_RELEASE_KEY)
with charm.provide_charm_instance() as instance:
instance.install()
reactive.set_state('charm.installed')
示例9: default_upgrade_charm
# 需要导入模块: from charms import reactive [as 别名]
# 或者: from charms.reactive import set_state [as 别名]
def default_upgrade_charm():
"""Default handler for the 'upgrade-charm' hook.
This calls the charm.singleton.upgrade_charm() function as a default.
"""
reactive.set_state('run-default-upgrade-charm')
示例10: default_update_status
# 需要导入模块: from charms import reactive [as 别名]
# 或者: from charms.reactive import set_state [as 别名]
def default_update_status():
"""Default handler for update-status state.
Just call update status.
"""
reactive.set_state('run-default-update-status')
示例11: make_default_install_handler
# 需要导入模块: from charms import reactive [as 别名]
# 或者: from charms.reactive import set_state [as 别名]
def make_default_install_handler():
"""Set the default charm.installed state so that the default handler in
layer-openstack can run.
Convoluted, because charms.reactive will only run handlers in the reactive
or hooks directory.
"""
reactive.set_state('charms.openstack.do-default-charm.installed')
示例12: make_default_amqp_connection_handler
# 需要导入模块: from charms import reactive [as 别名]
# 或者: from charms.reactive import set_state [as 别名]
def make_default_amqp_connection_handler():
"""Set the default amqp.connected state so that the default handler in
layer-openstack can run.
Convoluted, because charms.reactive will only run handlers in the reactive
or hooks directory.
"""
reactive.set_state('charms.openstack.do-default-amqp.connected')
示例13: make_default_setup_database_handler
# 需要导入模块: from charms import reactive [as 别名]
# 或者: from charms.reactive import set_state [as 别名]
def make_default_setup_database_handler():
"""Set the default shared-db.connected state so that the default handler in
layer-openstack can run.
Convoluted, because charms.reactive will only run handlers in the reactive
or hooks directory.
"""
reactive.set_state('charms.openstack.do-default-shared-db.connected')
示例14: make_default_setup_endpoint_connection
# 需要导入模块: from charms import reactive [as 别名]
# 或者: from charms.reactive import set_state [as 别名]
def make_default_setup_endpoint_connection():
"""Set the default identity-service.connected state so that the default
handler in layer-openstack can run.
Convoluted, because charms.reactive will only run handlers in the reactive
or hooks directory.
"""
reactive.set_state(
'charms.openstack.do-default-identity-service.connected')
示例15: make_setup_endpoint_available_handler
# 需要导入模块: from charms import reactive [as 别名]
# 或者: from charms.reactive import set_state [as 别名]
def make_setup_endpoint_available_handler():
"""Set the default identity-service.available state so that the default
handler in layer-openstack can run.
Convoluted, because charms.reactive will only run handlers in the reactive
or hooks directory.
"""
reactive.set_state(
'charms.openstack.do-default-identity-service.available')