當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。