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.info
is a dict and not a tuple. A lot of plugins had a trailing comma that caused it to be interpreted as a tuple.Update
Author
toAuthors
and follow the new format (Link, Handle, Name)The execute plugin endpoint no longer automatically changes the state of the
self.options
dict 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_message
was moved fromMainMenu
toplugin_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
PluginInfo
instead of a dictself.info["Name"]
is nowself.info.name
plugins now require a
plugin.yaml
file (added in 5.9)all
self.info
fields are now in theplugin.yaml
file.plugin
files are no longer supported and won't be loadedThe
Plugin
class is now calledBasePlugin
Plugin constructors now take a
PluginInfo
object as the second positional argumentRemoved
Category
fromPluginInfo
which was not usedPlugin execute function must take
**kwargs
Plugin name is now based on the name in the
plugin.yaml
file instead of the filenamemainMenu
is nowmain_menu
BasePlugin moved from common to core
Sending socketio messages can now be done via
self.send_socketio_message
which will automatically use the correct plugin idonLoad
renamed toon_load
and receives adb
objectPlugins can now be turned on and off via the API without needing to use the
execute
functionPlugins have an
enabled
boolean 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
register
function was removedinstall_path
is automatically set onBasePlugin
constructorPlugins have an internal state that can be defined in a similar way to execution and module options
Internal state persists through database restarts
options
is nowexecution_options
New 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 = False
PluginTask
should now use the id of the plugin instead of the name
Last updated
Was this helpful?