From 2872faab98de32f54a96b82a0ece70e42673bb05 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sun, 21 Jan 2024 22:47:56 +0100 Subject: [PATCH] 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. --- CHANGELOG.md | 1 + packages/host/src/Host.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0df07f19..9b4c4bf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/packages/host/src/Host.ts b/packages/host/src/Host.ts index 5ecfb5bd..7381ad36 100644 --- a/packages/host/src/Host.ts +++ b/packages/host/src/Host.ts @@ -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; }