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