Skip loading plugins without entrypoint on hosts

If a plugin only has entrypoints at the controller level the config will
skip adding a "load_plugin" config option for the given plugin to avoid
making options that do nothing.  If such a plugin is added to a host it
will still reach loadPlugin which in turn tries to check the load_plugin
config and throw an error on startup due the field being missing.

Skip trying to load plugins without an entrypoint at the instance or
host level in hosts before checking the load_plugin config field.
This commit is contained in:
Hornwitser committed 2024-01-21 23:49:19 +01:00
1 parent 1d1e80fbf0
commit 2872faab98
2 files changed
+5 -1

No files matched your search

+1
View File
@@ -10,6 +10,7 @@
- Fixed generated systemd file for clusteriohost not enabling source maps.
- Fixed ctl not exporting types used for adding commands to ctl plugins.
- Fixed controller only plugins throwing an error about missing a config field on startup out when added to hosts.
## Version 2.0.0-alpha.14
+4 -1
View File
@@ -377,7 +377,10 @@ export default class Host extends lib.Link {
async loadPlugins() {
for (let pluginInfo of this.pluginInfos) {
if (!this.config.get(`${pluginInfo.name}.load_plugin` as keyof lib.HostConfigFields)) {
if (
!pluginInfo.hostEntrypoint && !pluginInfo.instanceEntrypoint
|| !this.config.get(`${pluginInfo.name}.load_plugin` as keyof lib.HostConfigFields)
) {
continue;
}