nornir.core.plugins.register

class nornir.core.plugins.register.PluginRegister(entry_point: str)
auto_register() → None

Register every plugin advertised under the entry point of this register.

Any installed package that declares an entry point in the group given to the constructor is picked up, which is how third party plugins become available without being imported explicitly. Registering the same plugin twice under the same name is not an error, so this is safe to call repeatedly.

Raises:

nornir.core.exceptions.PluginAlreadyRegistered – two different plugins are advertised under the same name

available: dict[str, T] = {}
deregister(name: str) → None

Deregister a registered plugin by its name.

Parameters:

name – name of the plugin to deregister

Raises:

nornir.core.exceptions.PluginNotRegistered – no plugin is registered under the given name

deregister_all() → None

Deregister all registered plugins.

get_plugin(name: str) → T

Fetch the plugin by name if already registered.

Parameters:

name – name of the plugin

Returns:

The plugin registered under the given name.

Raises:

nornir.core.exceptions.PluginNotRegistered – no plugin is registered under the given name

register(name: str, plugin: T) → None

Register a plugin with a specified name.

Parameters:
  • name – name of the connection plugin to register

  • plugin – plugin class

Raises:

nornir.core.exceptions.PluginAlreadyRegistered – another plugin with the specified name was already registered