thin-edge / thin-edge.io

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

tedge reconnect c8y displays an erroneous warning about invalid configured URL and a former tenant #2863

Closed reubenmiller closed 6 months ago

reubenmiller commented 6 months ago

Describe the bug

An erroneous warning message is displayed when calling tedge connect c8y when connecting to a Cumulocity IoT domain which warns about removing the certificate from the format tenant, even though the domains are the same.

Warning: Connecting to example.c8y.io, but the configured URL is example.c8y.io:8883.
The device certificate has to be removed from the former tenant.

It is likely that this error false positive was introduced in https://github.com/thin-edge/thin-edge.io/issues/2787 (but this is unconfirmed).

To Reproduce

  1. Using an already configured thin-edge.io device connect with c8y, run

    sudo tedge reconnect c8y

    Inspect the console output.

Expected behavior

Connecting to the same Cumulocity IoT instance should not print a warning about switching Cumulocity IoT domains.

Screenshots

Environment (please complete the following information):

Property Value
OS [incl. version] Debian GNU/Linux 12 (bookworm)
Hardware [incl. revision] Raspberry Pi 5 Model B Rev 1.0
System-Architecture Linux rpi5-d83add9f145a 6.1.0-rpi7-rpi-2712 #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64 GNU/Linux
thin-edge.io version tedge 1.0.2~269+gc85c4ae

Additional context

Full logs

# tedge reconnect c8y
Removing Cumulocity bridge.

Applying changes to mosquitto.

Cumulocity Bridge successfully disconnected!

Stopping tedge-mapper-c8y service.

Disabling tedge-mapper-c8y service.

tedge-mapper-c8y service successfully stopped and disabled!

Detected mosquitto version >= 2.0.0
Checking if systemd is available.

Checking if configuration for requested bridge already exists.

Validating the bridge certificates.

Creating the device in Cumulocity cloud.

Saving configuration for requested bridge.

Restarting mosquitto service.

Awaiting mosquitto to start. This may take up to 5 seconds.

Enabling mosquitto service on reboots.

Successfully created bridge connection!

Sending packets to check connection. This may take up to 2 seconds.

Connection check is successful.

Checking if tedge-mapper is installed.

Starting tedge-mapper-c8y service.

Persisting tedge-mapper-c8y on reboot.

tedge-mapper-c8y service successfully started and enabled!

Warning: Connecting to example.c8y.io, but the configured URL is example.c8y.io:8883.
The device certificate has to be removed from the former tenant.

Enabling software management.

Checking if tedge-agent is installed.

Starting tedge-agent service.

Persisting tedge-agent on reboot.

tedge-agent service successfully started and enabled!
reubenmiller commented 6 months ago

An existing system test was modified to include the check for this particular bug. See the PR for the test name. https://github.com/thin-edge/thin-edge.io/pull/2865/files

gligorisaev commented 6 months ago

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