-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix(cmd): prevent adding connection with invalid identities file #26042
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
base: main
Are you sure you want to change the base?
fix(cmd): prevent adding connection with invalid identities file #26042
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: axel7083 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Code LGTM |
ashley-cui
left a comment
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
cmd/podman/system/connection/add.go
Outdated
| case errors.Is(err, os.ErrNotExist): | ||
| logrus.Warnf("%q does not exist", entities.Identity) | ||
| case errors.Is(err, os.ErrPermission): | ||
| logrus.Warnf("You do not have permission to read %q", entities.Identity) |
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.
Why print a warning? Your commit says prevent adding but this doesn't prevent it at all.
IMO simply returning the error is the easiest and there is no need for us to special case each error, the orginal error should have enough information.
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.
unthoughtful copy paste from the line bellow :p
podman/cmd/podman/system/connection/add.go
Lines 162 to 169 in ae1f0b4
| info, err := os.Stat(uri.Path) | |
| switch { | |
| case errors.Is(err, os.ErrNotExist): | |
| logrus.Warnf("%q does not exist", uri.Path) | |
| case errors.Is(err, os.ErrPermission): | |
| logrus.Warnf("You do not have permission to read %q", uri.Path) | |
| case err != nil: | |
| return err |
anyway I applied your suggestion
f06f112 to
ae1f0b4
Compare
|
please add a test |
ae1f0b4 to
3755d3d
Compare
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
3755d3d to
98575e5
Compare
|
LGTM |
|
A friendly reminder that this PR had no activity for 30 days. |
Fixes #26016
Does this PR introduce a user-facing change?