-
Notifications
You must be signed in to change notification settings - Fork 66
fix: tedge cert renew returning success exit code on error #3525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: tedge cert renew returning success exit code on error #3525
Conversation
Codecov ReportAttention: Patch coverage is 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
Robot Results
|
cbceba9
to
ec2bf68
Compare
.or_else(|err| { | ||
if key_path.exists() { | ||
Err(err) | ||
} else { | ||
Ok(KeyKind::New) | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The root cause of the error-prone hint was to conflate all error cases into a file not found error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the behaviour of tedge cert renew
for self-signed certificate is intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. Works nicely now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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
Proposed changes
tedge cert renew
exits with status code 1 on errortedge cert renew
returning a confusing error message when the private key cannot be readTypes of changes
Paste Link to the issue
#3524
Checklist
just prepare-dev
once)just format
as mentioned in CODING_GUIDELINESjust check
as mentioned in CODING_GUIDELINESFurther comments