feat(facts.podman): add more basic facts - #1900
Open
lsg551 wants to merge 2 commits into
Open
Conversation
This commit adds to the 2 existing Podman facts (.PodmanPs to list containers and .PodmanSystemInfo for podman system information) the following new facts: 1. .PodmanImages to get the output from `podman image ls` / list container image in the local storage 2. .PodmanVolumes similarly lists volumes 3. .PodmanPods lists pods 4. .PodmanQuadlets lists quadlets files (`podman quadlet list`, available since Podman v5.6.0) 5. .PodmanNetworks lists podman networks, including the default bridge
Updated the docstrings of facts for `podman.PodmanPs` and `podman.PodmanSystemInfo`. 7390979 added a few more basic facts for Podman; their writing style is slightly different and includes examples. The commit aligns the existing ones with the new ones.
wowi42
requested changes
Aug 25, 2026
wowi42
left a comment
Collaborator
There was a problem hiding this comment.
Nice addition, the helper and the docstring examples are good. One blocker:
PodmanNetworks.process contains leftover debug code that writes test_podman.json to the current working directory on every fact call. I checked out the branch and ran the podman fact tests: the file lands in the repo root as an untracked artifact. In production this would write a file on the client machine every time the fact runs. Please remove it.
Smaller notes:
PodmanPs.processstill usesassert isinstance(output, list)plus# type: ignore. Now that_parse_podman_json_listexists, routePodmanPsthrough it too. (assertinsrc/is dropped underpython -O, so the helper is also the safer pattern.)- On your caveat about exception handling: wrapping parse failures in
FactProcessErroris the right call, keep it. The bareexcept Exceptionclause afterexcept json.JSONDecodeErroris redundant though; one or the other is enough. - Typo in the helper docstring: "parasing".
- New fixtures should be YAML rather than JSON (project convention for new fixtures). Not blocking since the existing podman fixtures are JSON too, but worth doing.
- The Podman version note on
PodmanQuadlets(>= 5.6.0, unchecked) is fine.
Tests and lint pass on the branch, docs examples look right.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The facts for Podman as of now (v3.9.2) include two basic facts:
podman.PodmanPsto list the existing running/exited/... containers (equivalent topodman ps -a)podman.PodmanSystemInfoto get Podman system information (=podman system info)This PR extends this list with the following new facts:
.PodmanImagesto get the output frompodman image ls/ listcontainer image in the local storage
.PodmanVolumessimilarly lists volumes.PodmanPodslists pods.PodmanQuadletslists quadlets files (podman quadlet list, available since Podman v5.6.0).PodmanNetworkslists podman networksNothing fancy, it just (like the existing two) wraps the Podman CLI and forwards the JSON output.
Checklist
3.xat this time)scripts/dev-test.sh)scripts/dev-lint.sh)conventional commits format
Caveats
asserts. I decided to wrap any exception raised while fact processing in theFactProcessError. Let me know what's the preference here.podman quadlet <cmd>stuff was only recently added in Podman v5.6.0 (published 2025-08-15). The new factpodman.PodmanQuadletsis using this and would fail if this version constraint is not met. I added a note in the docstring. If this is desired, I could also implement an internal version check based on the existing facts (which would still cause a failure but point the user to the exact root cause...). (But I don't know where/how exactly - yet.)PS: sorry if I should have opened an issue before (the contributing guidelines did not mention this though)