Skip to content
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

podman load: fix error handling #9677

Merged
merged 1 commit into from
Mar 9, 2021

Conversation

vrothberg
Copy link
Member

Make sure to properly return loading errors and to set the exit code
accordingly.

Fixes: #9672
Signed-off-by: Valentin Rothberg [email protected]

Make sure to properly return loading errors and to set the exit code
accordingly.

Fixes: containers#9672
Signed-off-by: Valentin Rothberg <[email protected]>
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 9, 2021
@rhatdan
Copy link
Member

rhatdan commented Mar 9, 2021

LGTM

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, vrothberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@vrothberg
Copy link
Member Author

Merge me

@baude
Copy link
Member

baude commented Mar 9, 2021

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 9, 2021
@openshift-merge-robot openshift-merge-robot merged commit 09473d4 into containers:master Mar 9, 2021
# Regression test for #9672 to make sure invalid input yields errors.
invalid=$PODMAN_TMPDIR/invalid
echo "I am an invalid file and should cause a podman-load error" > $invalid
run_podman 125 load -i $invalid
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wish I'd seen this earlier. In future, I encourage you to check the error message. I'll open a PR to add that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you be doing yoga on a mountain peek? :)

I didn't add checks since the error messages are ugly. It's something I want to improve soon.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you be doing yoga on a mountain peak? :)

What makes you think I'm not? 😉

Ugly or not, the reason for error-message checking is to save yourself from typos or syntax errors:

    run_podman load -i $imvalid      <--- misspelled variable name, yields "flag needs an argument"
    run_podman load -i $nonexistent_path  <--- yields "no such file or directory"

...or other mistakes that throw an error for other reasons. (None of those are likely in this case, the code looks good, but an error-message check will greatly reassure future maintainers)

@vrothberg vrothberg deleted the fix-9672 branch March 9, 2021 15:06
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman load with invalid input has 0 (success) exit code
7 participants