"plugin_init" function is called without the plugin being enabled
Closed this issue · 2 comments
Describe the behavior
On north service, "plugin_init" function is called without the plugin being enabled.
To Reproduce
Using the iec104north version 1.1.0 from fledgepower,
- Install and configure the plugin,
- Start Fledge,
- Check that the plugin is not enabled with /fledge/schedule API,
- Check the iec104north plugin log,
- In the log, we can see that the plugin code located in "plugin_init" is executed.
Example of execution log:
Oct 26 13:41:55 745d6136f8bc Fledge iec104north_c1[732]: ERROR: Missing name in configuration
Oct 26 13:41:55 745d6136f8bc Fledge iec104north_c1[732]: ERROR: Service is not registered with the core - not registering configuration interest
Oct 26 13:41:54 745d6136f8bc Fledge iec104north_c1[732]: ERROR: Failed Payload: { "destination" : "broadcast","source" : "service", "source_name" : "iec104north_c1", "operation" : { "request_connection_status" : { "desc": "request connection status" } } }
Oct 26 13:41:54 745d6136f8bc Fledge iec104north_c1[732]: ERROR: Failed to send control operation '/dispatch/operation' to dispatcher service, 400 Bad Request { "error" : "invalid service bearer token" }
Oct 26 13:41:54 745d6136f8bc Fledge iec104north_c1[732]: WARNING: Send request_connection_status operation
Oct 26 13:41:54 745d6136f8bc Fledge iec104north_c1[732]: WARNING: RegisterControl is called
Oct 26 13:41:54 745d6136f8bc Fledge iec104north_c1[732]: WARNING: Control operations have been enabled
Oct 26 13:41:54 745d6136f8bc Fledge iec104north_c1[732]: WARNING: m_oper not set -> call registerControl
Oct 26 13:41:54 745d6136f8bc Fledge iec104north_c1[732]: WARNING: Server started - mode: CONNECT_ALWAYS
Oct 26 13:41:54 745d6136f8bc Fledge iec104north_c1[732]: WARNING: m_oper not set -> call registerControl
Expected behavior
We were expecting the north (but also south) service not to execute any code of the plugin until it is enabled.
Additional context
Fledge version 2.2.0
This is expected behaviour. The pliugin_init entry point is called in order to request the default configuration for the plugin, when we open the UI to either list alll the plugins or get potential configuration of the plugins we call plugin_init to retrieve the configuration items.
We have changed the code in the iec104north plugin to use "plugin_start" entry point method instead of "plugin_init" for the server startup.