Migration
This is an exhaustive list of changes that have been made to the plugin system between major Empire versions.
4->5 Migration
Not a lot has changed for plugins in Empire 5.0. We've just added a few guard rails for better stability between Empire versions.
The plugin interface is a guarantee that certain functionality will not be changed outside of major
Empire version updates (ie 4->5). So which functions are guaranteed? Any of the functions on thecore/*_service classes not prefixed with a _.
Does this mean you can't use util functions or modify state in other parts of the empire code?
No. In most cases you will be fine to do so. We as maintainers just can't keep track of any and
every thing a plugin may be doing and guarantee that it won't break in a minor/patch update.
This is no different than the way things were pre 5.0.
Make sure
self.infois a dict and not a tuple. A lot of plugins had a trailing comma that caused it to be interpreted as a tuple.Update
AuthortoAuthorsand follow the new format (Link, Handle, Name)The execute plugin endpoint no longer automatically changes the state of the
self.optionsdict inside the plugin. Instead, it sends validated parameters to the plugin as a dict and the plugin itself should decide whether it makes sense to modify the internal state or not.plugin_socketio_messagewas moved fromMainMenutoplugin_service.Example conversion for a 5.0 plugin can be seen in ChiselServer-Plugin
5->6 Migration
self.info is now an object of type
PluginInfoinstead of a dictself.info["Name"]is nowself.info.name
plugins now require a
plugin.yamlfile (added in 5.9)all
self.infofields are now in theplugin.yamlfile.pluginfiles are no longer supported and won't be loadedThe
Pluginclass is now calledBasePluginPlugin constructors now take a
PluginInfoobject as the second positional argumentRemoved
CategoryfromPluginInfowhich was not usedPlugin execute function must take
**kwargsPlugin name is now based on the name in the
plugin.yamlfile instead of the filenamemainMenuis nowmain_menuBasePlugin moved from common to core
Sending socketio messages can now be done via
self.send_socketio_messagewhich will automatically use the correct plugin idonLoadrenamed toon_loadand receives adbobjectPlugins can now be turned on and off via the API without needing to use the
executefunctionPlugins have an
enabledboolean attribute that is set in the database and on the plugin object
Lifecycle functions -
on_load- When the plugin is loaded into memoryon_unload- When the plugin is unloaded from memoryon_start- When the plugin is startedon_stop- When the plugin is stopped
registerfunction was removedinstall_pathis automatically set onBasePluginconstructorPlugins have an internal state that can be defined in a similar way to execution and module options
Internal state persists through database restarts
optionsis nowexecution_optionsNew config options -
auto_start- Automatically start the plugin when Empire startsIf using
auto_start, the default settings should be valid
auto_execute- Automatically execute the plugin when Empire starts
Execution can be disabled by setting
self.execution_enabled = FalsePluginTaskshould now use the id of the plugin instead of the name
Last updated
Was this helpful?