thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
221 stars 54 forks source link

don't restart tedge-agent service when using tedge connect or tedge reconnect #2494

Closed reubenmiller closed 10 months ago

reubenmiller commented 10 months ago

Is your feature improvement request related to a problem? Please describe.

Executing tedge connect c8y or tedge reconnect c8y rebuilds the bridge configuration and automatically restarts the tedge-agent regardless if it is running. The restarting of the tedge-agent is problematic and no longer required since the decoupling of the tedge-agent to any mapper specific logic.

Being able to update the c8y bridge configuration is useful when performing firmware updates, however if the tedge-agent is restarted, this causes teh firmware update workflow to be interrupted as the tedge-agent is responsible for running the firmware update workflow (e.g. the workflow step would essentially kill the process which is running it.)

Describe the solution you'd like

Don't restart tedge-agent if the service is already running when running the following commands:

Generally service managers already support starting a service in an idempotent way, so it should be a simple case of just using starting the service rather than restarting (you probably don't even need to check if the service is already running yourself)

Describe alternatives you've considered

Additional context

reubenmiller commented 10 months ago

Test included under:

gligorisaev commented 10 months ago

QA has thoroughly checked the feature and here are the results: