[bug] Agent exits if device hasn't registered to openwisp controller yet
nemesifier opened this issue · 3 comments
If the device is not registered yet, the agent exits:
openwisp-monitoring: OpenWISP monitoring daemon stopping
openwisp-monitoring: uuid or key are not set, please add these to /etc/config/openwisp
This is wrong, because it means users will have to restart the agent manually each time they register a device, which is not what we want.
The agent needs to be smart enough and figure out that if there's a shared secret in the openwisp configuration, it means that openwisp-config has not registered yet but it should not exit like that.
We have to introduce a mechanism which allows the agent to wait for configuration changes and start automatically after the device registers.
I wonder if we can somehow force the openwisp-monitoring agent to automatically restart whenever the config of openwisp-config changes? @feckert do you know if this is possible?
@devkapilbansal any idea?
I will check it on weekends
I wonder if we can somehow force the openwisp-monitoring agent to automatically restart whenever the config of openwisp-config changes? @feckert do you know if this is possible?
reload trigger restarts the service when config changes but it don't work when our agent already exits due to an error. One possible solution may be is to start it from openwisp-config
itself when uuid and key are set. Or, we can add infinite wait if shared secret is present
PS - We can specify in readme that openwisp-monitoring needs to be started once device is registered