chaosmonkey.modules package

Submodules

chaosmonkey.modules.module_store module

ModulesStore Handle the dynamic load of modules outside the main package.

exception chaosmonkey.modules.module_store.ModuleLookupError(message)[source]

Bases: Exception

Represent a Module lookup error when a module is not found by its ref

class chaosmonkey.modules.module_store.ModulesStore(klass)[source]

Bases: object

Load and store modules from outside the app package

add(module)[source]
get(ref)[source]

Given a str reference of a class in a module (eg. ModuleName.ClassName) return the class so it can be instantiated

The module with the class must be loaded first using load or add method.

Parameters:ref – str representation of a class in a module
Returns:class ready for instantation
get_modules()[source]
list()[source]

List all loaded modules names. It will return a list withe the __name__ of each module :return:

load(path)[source]

Loads all modules found in a given path. It adds the path to the sys.path and import all modules found

Parameters:path – path for lookup modules
modules = []
remove(module_name)[source]
set_modules(modules)[source]

Module contents