ceilometer_utils.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:charm-ceilometer 作者: openstack 项目源码 文件源码
def register_configs():
    """
    Register config files with their respective contexts.
    Regstration of some configs may not be required depending on
    existing of certain relations.
    """
    # if called without anything installed (eg during install hook)
    # just default to earliest supported release. configs dont get touched
    # till post-install, anyway.
    release = (get_os_codename_package('ceilometer-common', fatal=False) or
               'grizzly')
    configs = templating.OSConfigRenderer(templates_dir=TEMPLATES,
                                          openstack_release=release)

    for conf in (CEILOMETER_CONF, HAPROXY_CONF):
        configs.register(conf, CONFIG_FILES[conf]['hook_contexts'])

    if init_is_systemd():
        configs.register(
            CEILOMETER_API_SYSTEMD_CONF,
            CONFIG_FILES[CEILOMETER_API_SYSTEMD_CONF]['hook_contexts']
        )

    if os.path.exists('/etc/apache2/conf-available'):
        configs.register(HTTPS_APACHE_24_CONF,
                         CONFIG_FILES[HTTPS_APACHE_24_CONF]['hook_contexts'])
    else:
        configs.register(HTTPS_APACHE_CONF,
                         CONFIG_FILES[HTTPS_APACHE_CONF]['hook_contexts'])
    if enable_memcache(release=release):
        configs.register(MEMCACHED_CONF, [context.MemcacheContext()])

    if run_in_apache():
        wsgi_script = "/usr/share/ceilometer/app.wsgi"
        configs.register(WSGI_CEILOMETER_API_CONF,
                         [context.WSGIWorkerConfigContext(name="ceilometer",
                                                          script=wsgi_script),
                          CeilometerContext(),
                          HAProxyContext()])
    return configs
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号