Open albinsuresh opened 2 years ago
Simple command executions like the ones shown above would be fine. But, if users start over using it by providing chained commands with &&
or piped commands with |
etc, the handling of such complex commands would be really tricky and even error prone. We might even take a stance that the usage of such special characters are not supported and writing a custom script is recommended to wrap such complex logic.
I like the idea of customizable "reload" commands 👍
Is your feature request related to a problem? Please describe.
The current
c8y_configuration_management
plugin sends a notification ontedge/configuration_change
topic after a downloaded configuration file is placed in the config location, so that, some other user process can consume this MQTT notification and do the needful to apply that updated configuration.Typically, the updated configuration is applied with a service reload(
systemctl reload <service-name>
) or restart(systemctl restart <service-name>
). It would be too much work for the end-user to write dedicated scripts/programs that listens to these MQTT notifications just to callsystemctl restart <service-name>
in response to that.It would have been nice if the
c8y_configuration_management
plugin supported a way to run such user defined commands after a configuration file is updated by it (after a download).Describe the solution you'd like
Provide a way to define an optional
command
field in the the config management plugin configuration file as follows:The plugin just needs to execute the provided command after the configuration file is updated, in addition to the MQTT notification that it's already sending.
This approach can be further extended by adding support for a
target-path
field as well, which is where the configuration plugin will keep the downloaded configuration file as follows:When the provided
command
is executed, that command can validate the downloaded configuration file contents for sanity, before it is "applied" to the actual config location defined aspath
. If thetarget-path
is not provided, the dowloaded file will directly be placed atpath
.