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


Python hookenv.Hooks类代码示例

本文整理汇总了Python中charmhelpers.core.hookenv.Hooks的典型用法代码示例。如果您正苦于以下问题:Python Hooks类的具体用法?Python Hooks怎么用?Python Hooks使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Hooks类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: joined

    def joined(self):
        """Indicate the relation is connected and install required plugins."""
        log("Installing and configuring gearman-plugin for Zuul communication")
        # zuul relation requires we install the required plugins and set the
        # address of the remote zuul/gearman service in the plugin setting.
        plugins = Plugins()
        plugins.install(PLUGINS)
        self.set_state("{relation_name}.connected")

        # Generate plugin config with address of remote unit.
        zuul_host = relation_get("private-address")
        zuul_config = ZUUL_CONFIG.format(zuul_host).encode("utf-8")
        write_file(
            GERMAN_PLUGIN, zuul_config, owner="jenkins", group="nogroup")

        # Restart jenkins so changes will take efect.
        service_restart("jenkins")

        # Trigger the extension hook to update it with zuul relation data, if
        # it's coded to do so.
        hooks = Hooks()
        hooks.execute(["extension-relation-joined"])
开发者ID:freeekanayaka,项目名称:interface-jenkins-zuul,代码行数:22,代码来源:requires.py

示例2: Hooks

    cleanup_ovs_netns,
    stop_neutron_ha_monitor_daemon,
    use_l3ha,
    NEUTRON_COMMON,
    assess_status,
    install_systemd_override,
    configure_apparmor,
    write_vendordata,
    pause_unit_helper,
    resume_unit_helper,
    remove_legacy_nova_metadata,
    disable_nova_metadata,
    remove_old_packages,
)

hooks = Hooks()
CONFIGS = register_configs()


@hooks.hook('install')
@harden()
def install():
    status_set('maintenance', 'Executing pre-install')
    execd_preinstall()
    src = config('openstack-origin')
    if (lsb_release()['DISTRIB_CODENAME'] == 'precise' and
            src == 'distro'):
        src = 'cloud:precise-icehouse'
    configure_installation_source(src)
    status_set('maintenance', 'Installing apt packages')
    apt_update(fatal=True)
开发者ID:openstack,项目名称:charm-neutron-gateway,代码行数:31,代码来源:neutron_hooks.py

示例3: Hooks

                        install_chef_cookbooks, \
                        run_recipe #pylint: disable=F0401


KAFKA_CONNECTOR_VERSION = "1.0.0"
ESB_VERSION = "4.9.0"
PING_SOAP_MESSAGE = """<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
   <soapenv:Body>
      <p:echoInt xmlns:p="http://echo.services.core.carbon.wso2.org">
         <in>1</in>
      </p:echoInt>
   </soapenv:Body>
</soapenv:Envelope>"""

HOOKS = Hooks()

@HOOKS.hook('install')
def install():
    # needed because of weird error
    fix_hostname_resolv()
    subprocess.check_call(['sudo', 'apt-get', 'update'])
    install_chef_zero()
    configure_chef_zero()
    # copy cookbooks and upload to server
    install_chef_cookbooks()
    # run wso2 esb cookbook
    run_recipe("wso2::esb")
    # Wait for ESB to start
    counter = 0
    print "Waiting for ESB to come online"
开发者ID:galgalesh,项目名称:tengu-charms,代码行数:31,代码来源:hooks.py


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