bootils.plugins package

Package and namespace for plugin implementations.

Built-in plugins live in bootils.plugins.core, and custome plugins are loaded from the file system into the bootils.plugins.custom namespace.

Submodules

bootils.plugins.loader module

Plugin management.

class bootils.plugins.loader.PluginBase(context)[source]

Bases: object

Base class for plugins.

This class defines the plugin interface (callbacks), and provides sensible default implementations so that a plugin only has to define those callbacks it needs to override.

cfg_list(key, section=None)[source]

Get a config value as a list.

configure(config)[source]

Store plugin-specific configuration.

control(command, *args, **options)[source]

Control a service / process.

This delegates to a control_‹command› method of a subclass, if one is found.

Returns:True if the command was handled successfully.
Return type:bool
name

Name of the plugin (e.g. for reporting).

post_check()[source]

Perform post-launch checks and generate results.

pre_check()[source]

Perform pre-launch checks and generate results.

result(ok, name, comment, diagnostics=None)[source]

Create checks.CheckResult with a qualified name.

class bootils.plugins.loader.PluginContext[source]

Bases: object

State held by plugins.

class bootils.plugins.loader.PluginExecutor(loader)[source]

Bases: object

Call plugin hooks in different life-cycle phases.

configure()[source]

Assemble configuration for each plugin and pass it on.

control(command, *args, **options)[source]

Delegates execution of the given command to all plugins, until one of them indicates it handled the task.

post_checks()[source]

Perform post-launch checks.

pre_checks()[source]

Perform pre-launch checks.

class bootils.plugins.loader.PluginLoader(cfg, appname)[source]

Bases: object

Load and manage plugins, both core and custom ones.

See also Package Discovery and Resource Access using pkg_resources.

DEFAULT_PLUGIN_PATH = [u'/etc/{appname}/plugin.d', u'{appdir}/plugin.d']
discover()[source]

Inspect the given search path and import any plugins found.

Returns the list of plugin classes.

classmethod load_into_context(ctx, project=None)[source]

Discovers plugins and places a PluginLoader instance in ctx.obj.plugins.