本文整理汇总了Python中charms_openstack.charm.provide_charm_instance方法的典型用法代码示例。如果您正苦于以下问题:Python charm.provide_charm_instance方法的具体用法?Python charm.provide_charm_instance怎么用?Python charm.provide_charm_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类charms_openstack.charm
的用法示例。
在下文中一共展示了charm.provide_charm_instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: configure_designate_full
# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import provide_charm_instance [as 别名]
def configure_designate_full(*args):
"""Write out all designate config include bootstrap domain info"""
# If cluster relation is available it needs to passed in
cluster = reactive.RelationBase.from_state('cluster.available')
if cluster is not None:
args = args + (cluster, )
dns_backend = reactive.RelationBase.from_state('dns-backend.available')
if dns_backend is not None:
args = args + (dns_backend, )
with provide_charm_instance() as instance:
instance.upgrade_if_available(args)
instance.configure_ssl()
instance.render_full_config(args)
try:
# the following function should only run once for the leader.
instance.create_initial_servers_and_domains()
_render_sink_configs(instance, args)
instance.render_rndc_keys()
instance.update_pools()
except subprocess.CalledProcessError as e:
hookenv.log("ensure_api_responding() errored out: {}"
.format(str(e)),
level=hookenv.ERROR)
示例2: render_config
# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import provide_charm_instance [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
示例3: init_db
# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import provide_charm_instance [as 别名]
def init_db():
with charm.provide_charm_instance() as charm_class:
charm_class.db_sync()
示例4: cluster_connected
# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import provide_charm_instance [as 别名]
def cluster_connected(hacluster):
with charm.provide_charm_instance() as charm_class:
charm_class.configure_ha_resources(hacluster)
charm_class.assess_status()
示例5: disable_services
# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import provide_charm_instance [as 别名]
def disable_services():
with charm.provide_charm_instance() as charm_class:
charm_class.disable_services()
示例6: render_config
# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import provide_charm_instance [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
示例7: cluster_connected
# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import provide_charm_instance [as 别名]
def cluster_connected(hacluster):
"""Configure HA resources in corosync"""
with charm.provide_charm_instance() as charm_class:
charm_class.configure_ha_resources(hacluster)
charm_class.assess_status()
示例8: configure_ceph
# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import provide_charm_instance [as 别名]
def configure_ceph(ceph):
with charm.provide_charm_instance() as charm_class:
# TODO(jamespage): refactor to avoid massaging helper
ceph_helper.KEYRING = charm_class.ceph_keyring
host.mkdir(os.path.dirname(charm_class.ceph_keyring))
ceph_helper.ensure_ceph_keyring(service=hookenv.service_name(),
key=ceph.key(),
user=charm_class.gnocchi_user,
group=charm_class.gnocchi_group)
示例9: provide_gnocchi_url
# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import provide_charm_instance [as 别名]
def provide_gnocchi_url(metric_service):
with charm.provide_charm_instance() as charm_class:
metric_service.set_gnocchi_url(charm_class.public_url)
示例10: configure_openvswitch
# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import provide_charm_instance [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')
示例11: unconfigure_openvswitch
# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import provide_charm_instance [as 别名]
def unconfigure_openvswitch(odl_ovsdb=None):
with charm.provide_charm_instance() as ovs_odl_charm:
ovs_odl_charm.unconfigure_openvswitch(odl_ovsdb)
reactive.remove_state('ovs.configured')
示例12: configure_neutron_plugin
# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import provide_charm_instance [as 别名]
def configure_neutron_plugin(neutron_plugin):
with charm.provide_charm_instance() as ovs_odl_charm:
ovs_odl_charm.configure_neutron_plugin(neutron_plugin)
示例13: odl_node_registration
# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import provide_charm_instance [as 别名]
def odl_node_registration(controller):
with charm.provide_charm_instance() as ovs_odl_charm:
ovs_odl_charm.register_node(controller)
示例14: odl_mac_registration
# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import provide_charm_instance [as 别名]
def odl_mac_registration(controller):
with charm.provide_charm_instance() as ovs_odl_charm:
ovs_odl_charm.register_macs(controller)
示例15: default_install
# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import provide_charm_instance [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')