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

Don't panic on podman4 machine configs #21573

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

baude
Copy link
Member

@baude baude commented Feb 8, 2024

we should not panic podman when it has to deal with a podman4 machine config. instead, we throw a soft error for machine ls and in all other cases, we throw a hard error stating that the machine config is incompatible.

a future PR will provide instructions on how to recover from this. current idea is something like podman machine reset which blows everything away machine-wise.

Does this PR introduce a user-facing change?

None

@openshift-ci openshift-ci bot added release-note-none approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 8, 2024
}

func (err *ErrIncompatibleMachineConfig) Error() string {
return fmt.Sprintf("incompatible machine config %q (%s) for this version of Podman", err.Path, err.Name)
Copy link
Member

Choose a reason for hiding this comment

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

registry.SetExitCode(os.ENOTSUP) ?

Copy link
Member Author

Choose a reason for hiding this comment

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

nope, we we also use this to emit a soft error ... the use case is like podman machine ls; as it is walking the dir for JSON files, it tries to read one; if we detect that this is an old config (version 0), we emit a soft error but continue on ... assuming we list another machine, it seems reasonable that the error code is 0 (meaning the ls worked).

In all other cases, where the VM name is provided (we are not walking a dir looking for files), then we do hard error and yes, in that case we could set the return code.

i think we have options to explore, for example, if the code above worked, we could make the soft error just a fmt.errorf instead of calling this actual error (the message could be the same). That way, again if the above worked, it would set the code.

thoughts?

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

code LGTM, some small comments for the test

@mheon
Copy link
Member

mheon commented Feb 9, 2024

LGTM. Validate is angry.

Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

openshift-ci bot commented Feb 10, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: baude, flouthoc

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

we should not panic podman when it has to deal with a podman4 machine
config.  instead, we throw a soft error for `machine ls` and in all
other cases, we throw a hard error stating that the machine config is
incompatible.

a future PR will provide instructions on how to recover from this.
current idea is something like `podman machine reset` which blows
everything away machine-wise.

Signed-off-by: Brent Baude <bbaude@redhat.com>
@mheon
Copy link
Member

mheon commented Feb 12, 2024

/lgtm
/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 12, 2024
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 12, 2024
@baude
Copy link
Member Author

baude commented Feb 12, 2024

wait on #21597 before removing hold

@baude
Copy link
Member Author

baude commented Feb 12, 2024

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 12, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 49aba43 into containers:main Feb 12, 2024
86 checks passed
@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label May 13, 2024
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators May 13, 2024
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. machine release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants