当前位置: 首页>>代码示例>>Python>>正文


Python charm.provide_charm_instance方法代码示例

本文整理汇总了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) 
开发者ID:openstack,项目名称:charm-designate,代码行数:25,代码来源:designate_handlers.py

示例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 
开发者ID:openstack,项目名称:charm-murano,代码行数:13,代码来源:murano_handlers.py

示例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() 
开发者ID:openstack,项目名称:charm-murano,代码行数:5,代码来源:murano_handlers.py

示例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() 
开发者ID:openstack,项目名称:charm-murano,代码行数:6,代码来源:murano_handlers.py

示例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() 
开发者ID:openstack,项目名称:charm-gnocchi,代码行数:5,代码来源:gnocchi_handlers.py

示例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 
开发者ID:openstack,项目名称:charm-gnocchi,代码行数:16,代码来源:gnocchi_handlers.py

示例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() 
开发者ID:openstack,项目名称:charm-gnocchi,代码行数:7,代码来源:gnocchi_handlers.py

示例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) 
开发者ID:openstack,项目名称:charm-gnocchi,代码行数:11,代码来源:gnocchi_handlers.py

示例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) 
开发者ID:openstack,项目名称:charm-gnocchi,代码行数:5,代码来源:gnocchi_handlers.py

示例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') 
开发者ID:openstack,项目名称:charm-openvswitch-odl,代码行数:6,代码来源:openvswitch_odl_handlers.py

示例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') 
开发者ID:openstack,项目名称:charm-openvswitch-odl,代码行数:6,代码来源:openvswitch_odl_handlers.py

示例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) 
开发者ID:openstack,项目名称:charm-openvswitch-odl,代码行数:5,代码来源:openvswitch_odl_handlers.py

示例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) 
开发者ID:openstack,项目名称:charm-openvswitch-odl,代码行数:5,代码来源:openvswitch_odl_handlers.py

示例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) 
开发者ID:openstack,项目名称:charm-openvswitch-odl,代码行数:5,代码来源:openvswitch_odl_handlers.py

示例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') 
开发者ID:openstack,项目名称:charm-layer-openstack,代码行数:15,代码来源:layer_openstack.py


注:本文中的charms_openstack.charm.provide_charm_instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。