-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 |
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
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
f06f112
to
ae1f0b4
Compare
Fixes #26016
Does this PR introduce a user-facing change?