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

fix(generate): accept array or object from podman inspect output #111

Merged
merged 1 commit into from
Sep 29, 2024

Conversation

k9withabone
Copy link
Member

Podman v5.0.0 and newer always returns an array from podman inspect. Older versions of Podman may return a single JSON object if there is only one result, notably for podman pod inspect.

Created a serde::de::Visitor for deserializing the output of podman inspect which accepts a map (object) or sequence (array).

Tested with both Podman v5.2.2 and v4.9.4 (via quay.io/containers/podman:v4.9.4 image).

Fixes: #94

Podman v5.0.0 and newer always returns an array from `podman inspect`.
Older versions of Podman may return a single JSON object if there is
only one result, notably for `podman pod inspect`.

Created a `serde::de::Visitor` for deserializing the output of
`podman inspect` which accepts a map (object) or sequence (array).

Tested with both Podman v5.2.2 and v4.9.4 (via
quay.io/containers/podman:v4.9.4 image).

Fixes: #94
Signed-off-by: Paul Nettleton <[email protected]>
@k9withabone k9withabone added the bug Something isn't working label Sep 27, 2024
@k9withabone k9withabone added this to the v0.3.1 milestone Sep 27, 2024
@k9withabone k9withabone merged commit 0983ae1 into main Sep 29, 2024
13 checks passed
@k9withabone k9withabone deleted the generate-pod-old-podman branch September 29, 2024 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix podlet generate pod to work with older versions of Podman
1 participant