Closed reubenmiller closed 1 year ago
Duplicated by https://github.com/thin-edge/thin-edge.io/issues/2172
Example of the new handling of the tedge connect
when the service manager is not available.
# tedge connect c8y
The system config file '/etc/tedge/system.toml' doesn't exist. Use '/bin/systemctl' as a service manager.
Checking if systemd is available.
Warning: 'systemd' service manager is not available on the system.
Checking if configuration for requested bridge already exists.
Validating the bridge certificates.
Creating the device in Cumulocity cloud.
Saving configuration for requested bridge.
'tedge connect' configured the necessary tedge components, but you will have to start the required services on your own.
Start/restart mosquitto and other thin edge components.
thin-edge.io works seamlessly with 'systemd'.
/ # echo $?
0
Describe the bug
The
tedge connect c8y
andtedge disconnect c8y
are inconsistent with the handling when the default service manager is not configured.For example, on an alpine docker container without systemd configured, and without the
/etc/tedge/systemtoml
file being present, the following command result in difference of behaviour:tedge disconnect c8y
0
, and a clear message that it is skipping the service manager actionstedge connect c8y
1
(e.g. error), and error message indicating that the service manager actions were the root cause of failureTo Reproduce
On an alpine 3.14 docker container without systemd installed, run the following steps as a root user:
c8y.url
and upload the device certificate to Cumulocity IoTtedge connect c8y
observe the exit code and log messages.should be0
tedge disconnect c8y
, the exit could, e.g.echo $?
Expected behavior
tedge connect c8y
command should exit with a0
exit code if it was successful creating the bridge configuration and if the service manager is not available.tedge connect c8y
command should use a similar warning as thetedge disconnect c8y
command, see below.Use case: Single-process containers
When running thin-edge.io under a single process container setup, there isn't a service manager to coordinate each of the processes as each container will only contain one service. Therefore using the
tedge connect c8y
is only useful to create the mosquitto bridge configuration file, and it does not need to restart the mosquitto broker as it can be hosted in another container. In this case thetedge connect c8y
is used to configure the device, and not used to actually start any of the processes/services.Screenshots
Below shows the raw command output from each of the tedge connect and disconnect commands.
Command: Disconnect => Returns exit code 0
Command: Connect => Returns exit code 1
The command exits with an exit code
1
.Environment (please complete the following information):
alpine linux 3.14
docker-ce running on aarch64
aarch64
0.10.0-209-gb9a17aba
Additional context