Package gofer :: Package agent :: Module plugin :: Class PluginLoader
[hide private]
[frames] | no frames]

Class PluginLoader

source code

Agent plugins loader.

Instance Methods [hide private]
list
load(self, eager=True)
Load the plugins.
source code
bool
__noload(self, cfg, eager)
Determine whether the plugin should be loaded.
source code
Module
__import(self, plugin, cfg)
Import a module by file name.
source code
str
__findplugin(self, plugin)
Find a plugin module.
source code
str
__mangled(self, plugin)
Get the module name for the specified plugin.
source code
Class Variables [hide private]
list PATH = ['/usr/share/gofer/plugins', '/usr/lib/gofer/plugins', ...
A list of paths to directories containing plugins.
Instance Variables [hide private]
dict plugins
A dict of plugins and configuratons
Method Details [hide private]

load(self, eager=True)

source code 

Load the plugins.

Parameters:
  • eager (bool) - Load disabled plugins.
Returns: list
A list of loaded plugins

__noload(self, cfg, eager)

source code 

Determine whether the plugin should be loaded.

Parameters:
  • cfg (PluginDescriptor) - A plugin descriptor.
  • eager (bool) - The eager load flag.
Returns: bool
True when not loaded.

__import(self, plugin, cfg)

source code 

Import a module by file name.

Parameters:
  • plugin (str) - The plugin (module) name.
  • cfg (PluginDescriptor) - A plugin descriptor.
Returns: Module
The loaded module.

__findplugin(self, plugin)

source code 

Find a plugin module.

Parameters:
  • plugin (str) - The plugin name.
Returns: str
The fully qualified path to the plugin module.
Raises:
  • Exception - When not found.

__mangled(self, plugin)

source code 

Get the module name for the specified plugin.

Parameters:
  • plugin (str) - The name of the plugin.
Returns: str
The (mangled if necessary) plugin's module name.

Class Variable Details [hide private]

PATH

A list of paths to directories containing plugins.
Type:
list
Value:
['/usr/share/gofer/plugins',
 '/usr/lib/gofer/plugins',
 '/usr/lib64/gofer/plugins',
 '/opt/gofer/plugins']