Python stevedore.NamedExtensionManager() Examples
The following are 5
code examples of stevedore.NamedExtensionManager().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
stevedore
, or try the search function
.
Example #1
Source File: __init__.py From oslo.middleware with Apache License 2.0 | 6 votes |
def __init__(self, *args, **kwargs): super(Healthcheck, self).__init__(*args, **kwargs) self.oslo_conf.register_opts(opts.HEALTHCHECK_OPTS, group='healthcheck') self._path = self._conf_get('path') self._show_details = self._conf_get('detailed') self._backends = stevedore.NamedExtensionManager( self.NAMESPACE, self._conf_get('backends'), name_order=True, invoke_on_load=True, invoke_args=(self.oslo_conf, self.conf)) self._accept_to_functor = collections.OrderedDict([ # Order here matters... ('text/plain', self._make_text_response), ('text/html', self._make_html_response), ('application/json', self._make_json_response), ]) self._accept_order = tuple(self._accept_to_functor) # When no accept type matches instead of returning 406 we will # always return text/plain (because sending an error from this # middleware actually can cause issues). self._default_accept = 'text/plain' self._ignore_path = False
Example #2
Source File: base.py From ironic-inspector with Apache License 2.0 | 6 votes |
def processing_hooks_manager(*args): """Create a Stevedore extension manager for processing hooks. :param args: arguments to pass to the hooks constructor. """ global _HOOKS_MGR if _HOOKS_MGR is None: names = [x.strip() for x in CONF.processing.processing_hooks.split(',') if x.strip()] _HOOKS_MGR = stevedore.NamedExtensionManager( 'ironic_inspector.hooks.processing', names=names, invoke_on_load=True, invoke_args=args, on_missing_entrypoints_callback=missing_entrypoints_callback, name_order=True) return _HOOKS_MGR
Example #3
Source File: dispatcher.py From dragonflow with Apache License 2.0 | 5 votes |
def load(self, *args, **kwargs): mgr = stevedore.NamedExtensionManager( 'dragonflow.controller.apps', self.apps_list, invoke_on_load=True, invoke_args=args, invoke_kwds=kwargs, ) for ext in mgr: self.apps[ext.name] = ext.obj
Example #4
Source File: datapath.py From dragonflow with Apache License 2.0 | 5 votes |
def _get_app_class(self, app_type): """Get an application class (Python class) by app name""" mgr = stevedore.NamedExtensionManager( 'dragonflow.controller.apps', [app_type], invoke_on_load=False, ) for ext in mgr: return ext.plugin else: raise RuntimeError(_('Failed to load app {0}').format(app_type))
Example #5
Source File: composite.py From aodh with Apache License 2.0 | 5 votes |
def threshold_evaluators(self): if not self._threshold_evaluators: threshold_types = ('ceilometer', 'gnocchi_resources_threshold', 'gnocchi_aggregation_by_metrics_threshold', 'gnocchi_aggregation_by_resources_threshold') self._threshold_evaluators = stevedore.NamedExtensionManager( 'aodh.evaluator', threshold_types, invoke_on_load=True, invoke_args=(self.conf,)) return self._threshold_evaluators