本文整理匯總了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')