From 1a470e7cfa48d30c7e912a8dffeebf773a550025 Mon Sep 17 00:00:00 2001 From: Andreas Wrede Date: Fri, 24 Apr 2026 12:58:42 +0200 Subject: [PATCH] Fix plugin config lookup shadowed by CLIENT_DEFAULTS plugins key CLIENT_DEFAULTS seeds "plugins": {} so raw_config.get("plugins", raw_config) always returned the empty subdict instead of falling back to the full config. Plugins configured at top-level (e.g. nagios_runner: ...) were therefore never found, resulting in "No Nagios commands configured". Now checks the plugins subdict first, then top-level keys, so both config layouts work correctly. Co-Authored-By: Claude Sonnet 4.6 --- hbd/client/plugin.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hbd/client/plugin.py b/hbd/client/plugin.py index 8c5b1fc..eac2e3f 100644 --- a/hbd/client/plugin.py +++ b/hbd/client/plugin.py @@ -312,9 +312,10 @@ class PluginLoader: loaded_count = 0 raw_config = config or {} - # Per-plugin config lives under the 'plugins' key; fall back to top-level - # for backwards compatibility. - plugin_config = raw_config.get("plugins", raw_config) + # Per-plugin config lives under the 'plugins' key or at top-level. + # CLIENT_DEFAULTS seeds "plugins": {} so the key always exists; check + # both the subdict and top-level so that either layout in .hbc.yaml works. + plugins_subconfig = raw_config.get("plugins", {}) # Scan for Python files for plugin_file in directory.glob("*.py"): @@ -359,8 +360,9 @@ class PluginLoader: self.logger.debug(f"Found plugin class: {name}") - # Instantiate plugin with config - plugin_instance_config = plugin_config.get(obj.name, {}) + # Instantiate plugin with config — check plugins subdict first, + # then top-level keys (e.g. nagios_runner: ... at root of config). + plugin_instance_config = plugins_subconfig.get(obj.name) or raw_config.get(obj.name, {}) plugin = obj(config=plugin_instance_config) # Initialize plugin