thin-edge.io icon indicating copy to clipboard operation
thin-edge.io copied to clipboard

inotify starts to work only after restarting c8y_configuration_plugin

Open gligorisaev opened this issue 2 years ago • 1 comments

Describe the bug inotify starts to work only after restarting c8y_configuration_plugin

To Reproduce

Precondition:

  • c8y-configuration-plugin is installed
  • DUT is connected to c8y
  • c8y-configuration-plugin service is started

Steps:

  1. change the configuration file /etc/tedge/c8y/c8y-configuration-plugin.toml
  2. Observe that in the on the cloud-side in the configuration management tab the changes will not be shown

Only after restarting c8y_configuration_plugin service inotify will start to work as expected and the changes in the configuration file will be shown after every change of the file even without restart

Expected behavior changes in the configuration file to be reflected on cloud without the need of rastarting the c8y_configuration_plugin service

Screenshots

Environment (please complete the following information):

  • OS [incl. version]
  • Hardware [incl. revision]
  • System-Architecture [e.g. result of "uname -a"]
  • thin-edge.io version [e.g. 0.1.0]

Additional context

gligorisaev avatar Sep 08 '22 11:09 gligorisaev

First step, a developer needs to investigate this issue. Let's spend 1 day for that.

rina23q avatar Sep 13 '22 09:09 rina23q

Update: Ignore this post. I had missed a step in the explanation above and the comments below are improvements rather than a bug find.

~OK, so. Here are my observations on the c8y configuration plugin:~

  • [ ] ~The c8y configuration plugin does not run --init as root user. See: (https://github.com/thin-edge/thin-edge.io/blob/main/configuration/debian/c8y_configuration_plugin/postinst).~ ~No-where in the service file is root user specified (https://github.com/thin-edge/thin-edge.io/blob/main/configuration/init/systemd/c8y-configuration-plugin.service);~ ~Nor in the Cargo.toml for the pluing: (https://github.com/thin-edge/thin-edge.io/blob/main/plugins/c8y_configuration_plugin/Cargo.toml).~

  • [ ] ~The service is not started on install of the debian package. This is the issue. As reported above, the service is required to be restarted for anything to work. This is because we are missing to start the plugin out of the box. To fix this we should simply add something along the lines of:~

[package.metadata.deb.systemd-units]
unit-scripts = "../../../configuration/init/systemd"
enable = true
start = true
stop-on-upgrade = true

~to the plugin's Cargo.toml (https://github.com/thin-edge/thin-edge.io/blob/main/plugins/c8y_configuration_plugin/Cargo.toml).~

~I will address in a PR the second box, but I am not sure what to do about the first. @rina23q since you are the owner of these files, I want to ask you what you think about the first box? And @didier-wenzek, @albinsuresh I want to ask your general opinion.~

cmosd avatar Oct 13 '22 11:10 cmosd

~I declare the investigation phase closed. And I estimated this task will take 0.5 to complete.~

cmosd avatar Oct 13 '22 11:10 cmosd

I can not reproduce this. The following steps were followed:

  • uninstall thin-edge with the new uninstall script using the remove option.
  • removed /etc/tedge/c8y and /etc/tege/operations (to force the plugin to create them)
  • install thin-edge with the install script
  • connected to c8y
  • started plugin
  • edited file in /etc/tedge/c8y/c8y-configuration-plugin.toml

All the messages are fine. I see 114 and 119 messages are sent correctly.

cmosd avatar Oct 13 '22 12:10 cmosd

Cannot reproduce it.

rina23q avatar Oct 25 '22 11:10 rina23q