From 2c7e3c4b9677cf291e08583d8b671c2362c8c6eb Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Fri, 19 Apr 2024 15:59:20 +0200 Subject: [PATCH] plugin load when adminspace entry for this plugin added (#952) * load but hangs * start plugin should be performed outside of validator * minimise diff --- zenoh/src/net/runtime/adminspace.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/zenoh/src/net/runtime/adminspace.rs b/zenoh/src/net/runtime/adminspace.rs index 56aa3e43b1..dde776f463 100644 --- a/zenoh/src/net/runtime/adminspace.rs +++ b/zenoh/src/net/runtime/adminspace.rs @@ -74,11 +74,13 @@ impl ConfigValidator for AdminSpace { current: &serde_json::Map, new: &serde_json::Map, ) -> ZResult>> { - let plugins_mgr = zlock!(self.context.plugins_mgr); - let plugin = plugins_mgr.started_plugin(name).ok_or(format!( - "Plugin `{}` is not running, but its configuration is being changed", - name - ))?; + let plugin_mgr = zlock!(self.context.plugins_mgr); + let Some(plugin) = plugin_mgr.started_plugin(name) else { + tracing::warn!("Plugin `{}` is not started", name); + // If plugin not started, just allow any config. The plugin `name` will be attempted to start with this config + // on config comparison (see `PluginDiff`) + return Ok(None); + }; plugin.instance().config_checker(path, current, new) } }