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


Python stevedore.ExtensionManager方法代码示例

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


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

示例1: plugins

# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import ExtensionManager [as 别名]
def plugins(ctx):
    """
    Displays available plugins and if they're enabled.
    """
    try:
        from nidaba.config import nidaba_cfg
    except IOError as e:
        if e.errno == 2:
            click.echo('plugins command only available for local installations.')
            ctx.exit()

    import stevedore

    mgr = stevedore.ExtensionManager(namespace='nidaba.plugins')
    enabled = set(nidaba_cfg['plugins_load'].keys()).intersection(set(mgr.names()))
    disabled = set(mgr.names()) - enabled
    for plugin in mgr.names():
        click.echo(plugin, nl=False)
        if plugin in disabled:
            click.secho(u' (disabled)', fg='red')
        else:
            click.secho(u' (enabled)', fg='green') 
开发者ID:OpenPhilology,项目名称:nidaba,代码行数:24,代码来源:cli.py

示例2: job_runner

# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import ExtensionManager [as 别名]
def job_runner(self):
        # Lazily import this since this module will be loaded on hadoop worker nodes however stevedore will not be
        # available in that environment.
        from stevedore import ExtensionManager

        extension_manager = ExtensionManager('mapreduce.engine')
        try:
            engine_class = extension_manager[self.mapreduce_engine].plugin
        except KeyError:
            raise KeyError('A map reduce engine must be specified in order to run MapReduceJobTasks')

        if issubclass(engine_class, MapReduceJobRunner):
            engine_kwargs = self._get_engine_parameters_from_targets()
            return engine_class(**engine_kwargs)
        else:
            return engine_class() 
开发者ID:edx,项目名称:edx-analytics-pipeline,代码行数:18,代码来源:mapreduce.py

示例3: test_entry_points

# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import ExtensionManager [as 别名]
def test_entry_points(self):
        factory_classes = {
            'catch_errors': 'CatchErrors',
            'correlation_id': 'CorrelationId',
            'cors': 'CORS',
            'debug': 'Debug',
            'healthcheck': 'Healthcheck',
            'http_proxy_to_wsgi': 'HTTPProxyToWSGI',
            'request_id': 'RequestId',
            'sizelimit': 'RequestBodySizeLimiter',
            'ssl': 'SSLMiddleware',
        }

        em = stevedore.ExtensionManager('paste.filter_factory')

        # Ensure all the factories are defined by their names
        factory_names = [extension.name for extension in em]
        self.assertThat(factory_names,
                        matchers.ContainsAll(factory_classes)) 
开发者ID:openstack,项目名称:oslo.middleware,代码行数:21,代码来源:test_entry_points.py

示例4: _get_extension_manager_of_resource

# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import ExtensionManager [as 别名]
def _get_extension_manager_of_resource(resource_name):
    """Get the resource specific ExtensionManager instance.

    :param resource_name: The name of the resource e.g.
        'system' / 'ethernet_interface' / 'update_service'
    :returns: the ExtensionManager instance
    :raises ExtensionError: on resource OEM extension load error.
    """
    global _global_extn_mgrs_by_resource

    if resource_name not in _global_extn_mgrs_by_resource:
        resource_namespace = 'sushy.resources.' + resource_name + '.oems'
        _global_extn_mgrs_by_resource[resource_name] = (
            _create_extension_manager(resource_namespace)
        )
    return _global_extn_mgrs_by_resource[resource_name] 
开发者ID:openstack,项目名称:sushy,代码行数:18,代码来源:common.py

示例5: list_opts

# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import ExtensionManager [as 别名]
def list_opts():
    """Returns a list of oslo.config options available in the library.

    The returned list includes all oslo.config options which may be registered
    at runtime by the library.

    Each element of the list is a tuple. The first element is the name of the
    group under which the list of elements in the second element will be
    registered. A group name of None corresponds to the [DEFAULT] group in
    config files.

    The purpose of this is to allow tools like the Oslo sample config file
    generator to discover the options exposed to users by this library.

    :returns: a list of (group_name, opts) tuples
    """
    key_manager_opts = []
    key_manager_opts.extend(key_manager.key_manager_opts)
    key_manager_opts.extend(utils.credential_opts)
    opts = [('key_manager', key_manager_opts)]

    ext_mgr = ExtensionManager(
        "castellan.drivers",
        invoke_on_load=True,
        invoke_args=[cfg.CONF])

    for driver in ext_mgr.names():
        opts.extend(ext_mgr[driver].obj.list_options_for_discovery())

    return opts 
开发者ID:openstack,项目名称:castellan,代码行数:32,代码来源:options.py

示例6: __init__

# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import ExtensionManager [as 别名]
def __init__(self, app, app_args, cmd_name=None):
        super(CompleteCommand, self).__init__(app, app_args, cmd_name)
        self._formatters = stevedore.ExtensionManager(
            namespace='cliff.formatter.completion',
        ) 
开发者ID:openstack,项目名称:cliff,代码行数:7,代码来源:complete.py

示例7: _load_formatter_plugins

# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import ExtensionManager [as 别名]
def _load_formatter_plugins(self):
        # Here so tests can override
        return stevedore.ExtensionManager(
            self.formatter_namespace,
            invoke_on_load=True,
        ) 
开发者ID:openstack,项目名称:cliff,代码行数:8,代码来源:display.py

示例8: get_plugin_list

# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import ExtensionManager [as 别名]
def get_plugin_list():
    """Gather plugin list and cache it"""

    global PLUGIN_LIST

    if PLUGIN_LIST is None:
        PLUGIN_LIST = stevedore.ExtensionManager(
            base.PLUGIN_NAMESPACE,
            invoke_on_load=False,
            propagate_map_exceptions=True,
        )
    return PLUGIN_LIST 
开发者ID:nttcom,项目名称:eclcli,代码行数:14,代码来源:auth.py

示例9: load_all_extensions

# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import ExtensionManager [as 别名]
def load_all_extensions():
    """Load all available modules with DF models"""
    manager = stevedore.ExtensionManager(  # noqa F841
        'dragonflow.db.models',
    )
    # NOTE(oanson) In case Stevedore changes and we need to manually load
    # the extensions:
    # modules = [extension.plugin for extension in manager] 
开发者ID:openstack,项目名称:dragonflow,代码行数:10,代码来源:all.py

示例10: get_extensions

# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import ExtensionManager [as 别名]
def get_extensions():
    global extension_checks
    if extension_checks is None:
        em = stevedore.ExtensionManager('oslo.policy.rule_checks',
                                        invoke_on_load=False)
        extension_checks = {
            extension.name: extension.plugin
            for extension in em
        }
    return extension_checks 
开发者ID:openstack,项目名称:oslo.policy,代码行数:12,代码来源:_checks.py

示例11: rule_conditions_manager

# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import ExtensionManager [as 别名]
def rule_conditions_manager():
    """Create a Stevedore extension manager for conditions in rules."""
    global _CONDITIONS_MGR
    if _CONDITIONS_MGR is None:
        _CONDITIONS_MGR = stevedore.ExtensionManager(
            'ironic_inspector.rules.conditions',
            invoke_on_load=True)
    return _CONDITIONS_MGR 
开发者ID:openstack,项目名称:ironic-inspector,代码行数:10,代码来源:base.py

示例12: rule_actions_manager

# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import ExtensionManager [as 别名]
def rule_actions_manager():
    """Create a Stevedore extension manager for actions in rules."""
    global _ACTIONS_MGR
    if _ACTIONS_MGR is None:
        _ACTIONS_MGR = stevedore.ExtensionManager(
            'ironic_inspector.rules.actions',
            invoke_on_load=True)
    return _ACTIONS_MGR 
开发者ID:openstack,项目名称:ironic-inspector,代码行数:10,代码来源:base.py

示例13: introspection_data_manager

# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import ExtensionManager [as 别名]
def introspection_data_manager():
    global _INTROSPECTION_DATA_MGR
    if _INTROSPECTION_DATA_MGR is None:
        _INTROSPECTION_DATA_MGR = stevedore.ExtensionManager(
            'ironic_inspector.introspection_data.store',
            invoke_on_load=True)
    return _INTROSPECTION_DATA_MGR 
开发者ID:openstack,项目名称:ironic-inspector,代码行数:9,代码来源:base.py

示例14: _create_extension_manager

# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import ExtensionManager [as 别名]
def _create_extension_manager(namespace):
    """Create the resource specific ExtensionManager instance.

    Use stevedore to find all vendor extensions of resource from their
    namespace and return the ExtensionManager instance.
    :param namespace: The namespace for the entry points. It maps to a
        specific Sushy resource type.
    :returns: the ExtensionManager instance
    :raises ExtensionError: on resource OEM extension load error.
    """
    # namespace format is:
    # ``sushy.resources.<underscore_joined_resource_name>.oems``
    resource_name = namespace.split('.')[-2]

    extension_manager = (
        stevedore.ExtensionManager(namespace=namespace,
                                   propagate_map_exceptions=True,
                                   on_load_failure_callback=_raise))

    LOG.debug('Resource OEM extensions for "%(resource)s" under namespace '
              '"%(namespace)s":',
              {'resource': resource_name, 'namespace': namespace})
    for extension in extension_manager:
        LOG.debug('Found vendor: %(name)s target: %(target)s',
                  {'name': extension.name,
                   'target': extension.entry_point_target})

    if not extension_manager.names():
        m = (('No extensions found for "%(resource)s" under namespace '
              '"%(namespace)s"') %
             {'resource': resource_name,
              'namespace': namespace})
        LOG.error(m)
        raise exceptions.ExtensionError(error=m)

    return extension_manager 
开发者ID:openstack,项目名称:sushy,代码行数:38,代码来源:common.py


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