-
Notifications
You must be signed in to change notification settings - Fork 72
tedge cert renew c8y does not return non-zero exit code if EST service is not available #3524
Description
Describe the bug
A failed cert renewal using the Cumulocity CA feature does not result in a non-zero exit code which makes more difficult to use it in a script to handle the renewal.
Below shows an example showing the error printed to the console, but the exit code is still zero.
$ tedge cert renew c8y
error: The device certificate cannot be renewed from http://127.0.0.1:8001/c8y/.well-known/est/simplereenroll:
404 Not Found <html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>openresty</center>
</body>
</html>$ echo $?
0To Reproduce
-
Configure thin-edge.io with a tenant which does not have the Cumulocity certificate-authority feature enabled
-
On board the device with a self-signed certificate
-
Try to renew the certificate (using the certificate-authority)
tedge cert renew c8y
Expected behavior
The tedge cert renew c8y command should exit with a non-zero exit code if the certificate renewal was not successful.
This would enable the following logic in a shell script:
#!/bin/sh
if ! tedge cert renew c8y; then
echo "Warning: failed to renew certificate"
fiScreenshots
Environment (please complete the following information):
| Property | Value |
|---|---|
| OS [incl. version] | Debian GNU/Linux 12 (bookworm) |
| Hardware [incl. revision] | unknown |
| System-Architecture | Linux d82e7bd77e49 6.8.0-39-generic #39-Ubuntu SMP PREEMPT_DYNAMIC Sat Jul 6 02:50:39 UTC 2024 aarch64 GNU/Linux |
| thin-edge.io version | tedge 1.4.3~391+g945be87 |
Additional context