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


Python templating.OSConfigRenderer方法代码示例

本文整理汇总了Python中charmhelpers.contrib.openstack.templating.OSConfigRenderer方法的典型用法代码示例。如果您正苦于以下问题:Python templating.OSConfigRenderer方法的具体用法?Python templating.OSConfigRenderer怎么用?Python templating.OSConfigRenderer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在charmhelpers.contrib.openstack.templating的用法示例。


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

示例1: test_register_configs

# 需要导入模块: from charmhelpers.contrib.openstack import templating [as 别名]
# 或者: from charmhelpers.contrib.openstack.templating import OSConfigRenderer [as 别名]
def test_register_configs(self):
        class _mock_OSConfigRenderer():
            def __init__(self, templates_dir=None, openstack_release=None):
                self.configs = []
                self.ctxts = []

            def register(self, config, ctxt):
                self.configs.append(config)
                self.ctxts.append(ctxt)

        self.os_release.return_value = 'trusty'
        templating.OSConfigRenderer.side_effect = _mock_OSConfigRenderer
        _regconfs = nutils.register_configs()
        confs = [nutils.PG_CONF,
                 nutils.PG_HN_CONF,
                 nutils.PG_HS_CONF,
                 nutils.PG_IFCS_CONF,
                 nutils.OPS_CONF]
        self.assertItemsEqual(_regconfs.configs, confs) 
开发者ID:openstack,项目名称:charm-plumgrid-gateway,代码行数:21,代码来源:test_pg_gw_utils.py

示例2: assess_status_func

# 需要导入模块: from charmhelpers.contrib.openstack import templating [as 别名]
# 或者: from charmhelpers.contrib.openstack.templating import OSConfigRenderer [as 别名]
def assess_status_func(configs, check_services=None):
    """Helper function to create the function that will assess_status() for
    the unit.
    Uses charmhelpers.contrib.openstack.utils.make_assess_status_func() to
    create the appropriate status function and then returns it.
    Used directly by assess_status() and also for pausing and resuming
    the unit.

    NOTE(ajkavanagh) ports are not checked due to race hazards with services
    that don't behave sychronously w.r.t their service scripts.  e.g.
    apache2.
    @param configs: a templating.OSConfigRenderer() object
    @param check_services: a list of services to check.  If None, then
    services() is used instead.  To not check services pass an empty list.
    @return f() -> None : a function that assesses the unit's workload status
    """
    if check_services is None:
        check_services = services()
    required_interfaces = {}
    if relation_ids('identity-service'):
        required_interfaces['identity'] = ['identity-service']
    return make_assess_status_func(
        configs, required_interfaces,
        charm_func=customer_check_assess_status,
        services=check_services, ports=None) 
开发者ID:openstack,项目名称:charm-swift-proxy,代码行数:27,代码来源:swift_utils.py

示例3: register_configs

# 需要导入模块: from charmhelpers.contrib.openstack import templating [as 别名]
# 或者: from charmhelpers.contrib.openstack.templating import OSConfigRenderer [as 别名]
def register_configs():
    release = os_release('heat-common')
    configs = templating.OSConfigRenderer(templates_dir=TEMPLATES,
                                          openstack_release=release)

    confs = [HEAT_CONF, HEAT_API_PASTE, HAPROXY_CONF, ADMIN_OPENRC]
    for conf in confs:
        configs.register(conf, CONFIG_FILES[conf]['contexts'])

    if os.path.exists('/etc/apache2/conf-available'):
        configs.register(HTTPS_APACHE_24_CONF,
                         CONFIG_FILES[HTTPS_APACHE_24_CONF]['contexts'])
    else:
        configs.register(HTTPS_APACHE_CONF,
                         CONFIG_FILES[HTTPS_APACHE_CONF]['contexts'])

    if enable_memcache(release=release):
        configs.register(MEMCACHED_CONF,
                         CONFIG_FILES[MEMCACHED_CONF]['hook_contexts'])
    return configs 
开发者ID:openstack,项目名称:charm-heat,代码行数:22,代码来源:heat_utils.py

示例4: assess_status_func

# 需要导入模块: from charmhelpers.contrib.openstack import templating [as 别名]
# 或者: from charmhelpers.contrib.openstack.templating import OSConfigRenderer [as 别名]
def assess_status_func(configs):
    """Helper function to create the function that will assess_status() for
    the unit.
    Uses charmhelpers.contrib.openstack.utils.make_assess_status_func() to
    create the appropriate status function and then returns it.
    Used directly by assess_status() and also for pausing and resuming
    the unit.

    NOTE: REQUIRED_INTERFACES is augmented with the optional interfaces
    depending on the current config before being passed to the
    make_assess_status_func() function.

    @param configs: a templating.OSConfigRenderer() object
    @return f() -> None : a function that assesses the unit's workload status
    """
    required_interfaces = REQUIRED_INTERFACES.copy()
    required_interfaces.update(get_optional_interfaces())
    return make_assess_status_func(
        configs, required_interfaces,
        charm_func=check_optional_relations,
        services=services(),
        ports=determine_ports()) 
开发者ID:openstack,项目名称:charm-keystone,代码行数:24,代码来源:keystone_utils.py

示例5: assess_status_func

# 需要导入模块: from charmhelpers.contrib.openstack import templating [as 别名]
# 或者: from charmhelpers.contrib.openstack.templating import OSConfigRenderer [as 别名]
def assess_status_func(configs):
    """Helper function to create the function that will assess_status() for
    the unit.
    Uses charmhelpers.contrib.openstack.utils.make_assess_status_func() to
    create the appropriate status function and then returns it.
    Used directly by assess_status() and also for pausing and resuming
    the unit.

    NOTE: REQUIRED_INTERFACES is augmented with the optional interfaces
    depending on the current config before being passed to the
    make_assess_status_func() function.

    NOTE(ajkavanagh) ports are not checked due to race hazards with services
    that don't behave sychronously w.r.t their service scripts.  e.g.
    apache2.
    @param configs: a templating.OSConfigRenderer() object
    @return f() -> None : a function that assesses the unit's workload status
    """
    required_interfaces = REQUIRED_INTERFACES.copy()
    required_interfaces.update(get_optional_interfaces())
    return make_assess_status_func(
        configs, required_interfaces,
        charm_func=check_optional_relations,
        services=services(), ports=None) 
开发者ID:openstack,项目名称:charm-nova-cloud-controller,代码行数:26,代码来源:nova_cc_utils.py

示例6: register_configs

# 需要导入模块: from charmhelpers.contrib.openstack import templating [as 别名]
# 或者: from charmhelpers.contrib.openstack.templating import OSConfigRenderer [as 别名]
def register_configs():
    '''
    Returns an OSTemplateRenderer object with all required configs registered.
    '''
    release = os_release('nova-common')
    configs = templating.OSConfigRenderer(templates_dir=TEMPLATES,
                                          openstack_release=release)

    if relation_ids('ceph'):
        # Add charm ceph configuration to resources and
        # ensure directory actually exists
        mkdir(os.path.dirname(ceph_config_file()))
        mkdir(os.path.dirname(CEPH_CONF))
        # Install ceph config as an alternative for co-location with
        # ceph and ceph-osd charms - nova-compute ceph.conf will be
        # lower priority that both of these but thats OK
        if not os.path.exists(ceph_config_file()):
            # touch file for pre-templated generation
            open(ceph_config_file(), 'w').close()
        install_alternative(os.path.basename(CEPH_CONF),
                            CEPH_CONF, ceph_config_file())

    for cfg, d in resource_map().items():
        configs.register(cfg, d['contexts'])
    return configs 
开发者ID:openstack,项目名称:charm-nova-compute,代码行数:27,代码来源:nova_compute_utils.py

示例7: assess_status_func

# 需要导入模块: from charmhelpers.contrib.openstack import templating [as 别名]
# 或者: from charmhelpers.contrib.openstack.templating import OSConfigRenderer [as 别名]
def assess_status_func(configs):
    """Helper function to create the function that will assess_status() for
    the unit.
    Uses charmhelpers.contrib.openstack.utils.make_assess_status_func() to
    create the appropriate status function and then returns it.
    Used directly by assess_status() and also for pausing and resuming
    the unit.

    NOTE(ajkavanagh) ports are not checked due to race hazards with services
    that don't behave sychronously w.r.t their service scripts.  e.g.
    apache2.
    @param configs: a templating.OSConfigRenderer() object
    @return f() -> None : a function that assesses the unit's workload status
    """
    required_interfaces = REQUIRED_INTERFACES.copy()
    required_interfaces.update(get_optional_relations())
    return make_assess_status_func(
        configs, required_interfaces,
        services=services(), ports=None) 
开发者ID:openstack,项目名称:charm-nova-compute,代码行数:21,代码来源:nova_compute_utils.py

示例8: test_register_configs

# 需要导入模块: from charmhelpers.contrib.openstack import templating [as 别名]
# 或者: from charmhelpers.contrib.openstack.templating import OSConfigRenderer [as 别名]
def test_register_configs(self, mock_path_exists):
        self.os_release.return_value = 'havana'
        mock_path_exists.return_value = False

        class _mock_OSConfigRenderer():
            def __init__(self, templates_dir=None, openstack_release=None):
                self.configs = []
                self.ctxts = []

            def register(self, config, ctxt):
                self.configs.append(config)
                self.ctxts.append(ctxt)

        templating.OSConfigRenderer.side_effect = _mock_OSConfigRenderer
        _regconfs = nutils.register_configs()
        confs = ['/etc/neutron/neutron.conf',
                 '/etc/neutron/api-paste.ini',
                 '/etc/default/neutron-server',
                 '/etc/neutron/plugins/ml2/ml2_conf.ini',
                 '/etc/apache2/sites-available/openstack_https_frontend',
                 '/etc/haproxy/haproxy.cfg']
        self.assertEqual(sorted(_regconfs.configs), sorted(confs)) 
开发者ID:openstack,项目名称:charm-neutron-api,代码行数:24,代码来源:test_neutron_api_utils.py

示例9: assess_status_func

# 需要导入模块: from charmhelpers.contrib.openstack import templating [as 别名]
# 或者: from charmhelpers.contrib.openstack.templating import OSConfigRenderer [as 别名]
def assess_status_func(configs):
    """Helper function to create the function that will assess_status() for
    the unit.
    Uses charmhelpers.contrib.openstack.utils.make_assess_status_func() to
    create the appropriate status function and then returns it.
    Used directly by assess_status() and also for pausing and resuming
    the unit.

    NOTE: REQUIRED_INTERFACES is augmented with the optional interfaces
    depending on the current config before being passed to the
    make_assess_status_func() function.

    NOTE(ajkavanagh) ports are not checked due to race hazards with services
    that don't behave sychronously w.r.t their service scripts.  e.g.
    apache2.

    @param configs: a templating.OSConfigRenderer() object
    @return f() -> None : a function that assesses the unit's workload status
    """
    required_interfaces = REQUIRED_INTERFACES.copy()
    required_interfaces.update(get_optional_interfaces())
    return make_assess_status_func(
        configs, required_interfaces,
        charm_func=check_optional_relations,
        services=services(), ports=None) 
开发者ID:openstack,项目名称:charm-neutron-api,代码行数:27,代码来源:neutron_api_utils.py

示例10: do_openstack_upgrade

# 需要导入模块: from charmhelpers.contrib.openstack import templating [as 别名]
# 或者: from charmhelpers.contrib.openstack.templating import OSConfigRenderer [as 别名]
def do_openstack_upgrade(configs):
    """
    Perform an upgrade.  Takes care of upgrading packages, rewriting
    configs, database migrations and potentially any other post-upgrade
    actions.

    :param configs: The charms main OSConfigRenderer object.
    """
    new_src = config('openstack-origin')
    new_os_rel = get_os_codename_install_source(new_src)

    log('Performing OpenStack upgrade to %s.' % (new_os_rel))

    configure_installation_source(new_src)
    dpkg_opts = [
        '--option', 'Dpkg::Options::=--force-confnew',
        '--option', 'Dpkg::Options::=--force-confdef',
    ]
    apt_update(fatal=True)
    apt_upgrade(options=dpkg_opts, fatal=True, dist=True)
    reset_os_release()
    apt_install(determine_packages(), fatal=True)

    # set CONFIGS to load templates from new release
    configs.set_release(openstack_release=new_os_rel) 
开发者ID:openstack,项目名称:charm-openstack-dashboard,代码行数:27,代码来源:horizon_utils.py

示例11: assess_status_func

# 需要导入模块: from charmhelpers.contrib.openstack import templating [as 别名]
# 或者: from charmhelpers.contrib.openstack.templating import OSConfigRenderer [as 别名]
def assess_status_func(configs):
    """Helper function to create the function that will assess_status() for
    the unit.
    Uses charmhelpers.contrib.openstack.utils.make_assess_status_func() to
    create the appropriate status function and then returns it.
    Used directly by assess_status() and also for pausing and resuming
    the unit.

    NOTE(ajkavanagh) ports are not checked due to race hazards with services
    that don't behave sychronously w.r.t their service scripts.  e.g.
    apache2.
    @param configs: a templating.OSConfigRenderer() object
    @return f() -> None : a function that assesses the unit's workload status
    """
    return make_assess_status_func(
        configs, REQUIRED_INTERFACES,
        services=services(), ports=None) 
开发者ID:openstack,项目名称:charm-openstack-dashboard,代码行数:19,代码来源:horizon_utils.py

示例12: test_register_configs

# 需要导入模块: from charmhelpers.contrib.openstack import templating [as 别名]
# 或者: from charmhelpers.contrib.openstack.templating import OSConfigRenderer [as 别名]
def test_register_configs(self, _use_dvr):
        class _mock_OSConfigRenderer():
            def __init__(self, templates_dir=None, openstack_release=None):
                self.configs = []
                self.ctxts = []

            def register(self, config, ctxt):
                self.configs.append(config)
                self.ctxts.append(ctxt)

        _use_dvr.return_value = False
        self.os_release.return_value = 'icehouse'
        self.lsb_release.return_value = {'DISTRIB_CODENAME': 'precise'}
        templating.OSConfigRenderer.side_effect = _mock_OSConfigRenderer
        _regconfs = nutils.register_configs()
        confs = ['/etc/neutron/neutron.conf',
                 '/etc/neutron/plugins/ml2/ml2_conf.ini',
                 '/etc/default/openvswitch-switch',
                 '/etc/init/os-charm-phy-nic-mtu.conf']
        self.assertEqual(_regconfs.configs, confs) 
开发者ID:openstack,项目名称:charm-neutron-openvswitch,代码行数:22,代码来源:test_neutron_ovs_utils.py

示例13: test_register_configs_mitaka

# 需要导入模块: from charmhelpers.contrib.openstack import templating [as 别名]
# 或者: from charmhelpers.contrib.openstack.templating import OSConfigRenderer [as 别名]
def test_register_configs_mitaka(self, _use_dvr):
        class _mock_OSConfigRenderer():
            def __init__(self, templates_dir=None, openstack_release=None):
                self.configs = []
                self.ctxts = []

            def register(self, config, ctxt):
                self.configs.append(config)
                self.ctxts.append(ctxt)

        _use_dvr.return_value = False
        self.os_release.return_value = 'mitaka'
        self.lsb_release.return_value = {'DISTRIB_CODENAME': 'trusty'}
        templating.OSConfigRenderer.side_effect = _mock_OSConfigRenderer
        _regconfs = nutils.register_configs()
        confs = ['/etc/neutron/neutron.conf',
                 '/etc/neutron/plugins/ml2/openvswitch_agent.ini',
                 '/etc/default/openvswitch-switch',
                 '/etc/init/os-charm-phy-nic-mtu.conf']
        self.assertEqual(_regconfs.configs, confs) 
开发者ID:openstack,项目名称:charm-neutron-openvswitch,代码行数:22,代码来源:test_neutron_ovs_utils.py

示例14: assess_status_func

# 需要导入模块: from charmhelpers.contrib.openstack import templating [as 别名]
# 或者: from charmhelpers.contrib.openstack.templating import OSConfigRenderer [as 别名]
def assess_status_func(configs):
    """Helper function to create the function that will assess_status() for
    the unit.
    Uses charmhelpers.contrib.openstack.utils.make_assess_status_func() to
    create the appropriate status function and then returns it.
    Used directly by assess_status() and also for pausing and resuming
    the unit.

    Note that required_interfaces is augmented with neutron-plugin-api if the
    nova_metadata is enabled.

    NOTE(ajkavanagh) ports are not checked due to race hazards with services
    that don't behave sychronously w.r.t their service scripts.  e.g.
    apache2.
    @param configs: a templating.OSConfigRenderer() object
    @return f() -> None : a function that assesses the unit's workload status
    """
    required_interfaces = REQUIRED_INTERFACES.copy()
    if enable_nova_metadata():
        required_interfaces['neutron-plugin-api'] = ['neutron-plugin-api']
    return make_assess_status_func(
        configs, required_interfaces,
        services=services(), ports=None) 
开发者ID:openstack,项目名称:charm-neutron-openvswitch,代码行数:25,代码来源:neutron_ovs_utils.py

示例15: test_register_configs

# 需要导入模块: from charmhelpers.contrib.openstack import templating [as 别名]
# 或者: from charmhelpers.contrib.openstack.templating import OSConfigRenderer [as 别名]
def test_register_configs(self):
        class _mock_OSConfigRenderer():
            def __init__(self, templates_dir=None, openstack_release=None):
                self.configs = []
                self.ctxts = []

            def register(self, config, ctxt):
                self.configs.append(config)
                self.ctxts.append(ctxt)

        self.os_release.return_value = 'trusty'
        templating.OSConfigRenderer.side_effect = _mock_OSConfigRenderer
        _regconfs = nutils.register_configs()
        confs = ['/etc/sudoers.d/neutron_sudoers',
                 '/etc/neutron/plugins/plumgrid/plumlib.ini',
                 '/etc/neutron/plugins/plumgrid/pgrc']
        self.assertItemsEqual(_regconfs.configs, confs) 
开发者ID:openstack,项目名称:charm-neutron-api-plumgrid,代码行数:19,代码来源:test_neutron_plumgrid_plugin_utils.py


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