fix: tedge cert renew returning success exit code on error #3525
Merged
didier-wenzek merged 4 commits intothin-edge:mainfrom Apr 2, 2025
Merged
fix: tedge cert renew returning success exit code on error #3525didier-wenzek merged 4 commits intothin-edge:mainfrom
didier-wenzek merged 4 commits intothin-edge:mainfrom
Conversation
Codecov ReportAttention: Patch coverage is 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
Contributor
Robot Results
|
cbceba9 to
ec2bf68
Compare
didier-wenzek
commented
Apr 2, 2025
Comment on lines
+169
to
+175
| .or_else(|err| { | ||
| if key_path.exists() { | ||
| Err(err) | ||
| } else { | ||
| Ok(KeyKind::New) | ||
| } | ||
| }) |
Contributor
Author
There was a problem hiding this comment.
The root cause of the error-prone hint was to conflate all error cases into a file not found error.
rina23q
reviewed
Apr 2, 2025
Member
rina23q
left a comment
There was a problem hiding this comment.
I'm not sure the behaviour of tedge cert renew for self-signed certificate is intended.
reubenmiller
approved these changes
Apr 2, 2025
Contributor
reubenmiller
left a comment
There was a problem hiding this comment.
Approved. Works nicely now.
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
When run without enough privileges `tedge cert renew` was returning an error-prone message: ``` A private key already exists and would be overwritten. Run `tedge cert remove` first to generate a new certificate and private key. ``` With this fix the error points to the correct cause: ``` Error: failed to renew the device certificate from https://127.0.0.1 Caused by: 0: I/O error accessing the private key: "/etc/tedge/device-certs/demo-device-888.key" 1: Permission denied (os error 13) ``` Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
758b169 to
f34c00a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
tedge cert renewexits with status code 1 on errortedge cert renewreturning a confusing error message when the private key cannot be readTypes of changes
Paste Link to the issue
#3524
Checklist
just prepare-devonce)just formatas mentioned in CODING_GUIDELINESjust checkas mentioned in CODING_GUIDELINESFurther comments