podman icon indicating copy to clipboard operation
podman copied to clipboard

Add `podman quadlet exists` command

Open mheon opened this issue 3 weeks ago • 2 comments

Feature request description

Our other command suites have exists commands to easily check if a given object exists (e.g. podman container exists). We don't have that for Quadlets.

Suggest potential solution

Add a new command, podman quadlet exists. Returns 0 if an Quadlet with the given name exists, 1 otherwise.

Have you considered any alternatives?

Could just use quadlet list but that's much less elegant

Additional context

N/A

mheon avatar Nov 10 '26 20:11 mheon

Hi, I'd like to work on this one. I went through the quadlet code (cmd/podman/quadlet, pkg/domain/infra/abi/quadlet.go, and the existing exists handler). The engine method and REST endpoint are already there, so my plan is to add the CLI command on top of them, with a man page entry and a system test. Could you assign it to me?

/assign

i-OmSharma avatar Nov 13 '26 16:11 i-OmSharma

Two questions before I start. Both are about behavior the code already has, so I want to match what you intend.

Bare name (myapp without .container). QuadletExists goes through getQuadletPathByName, which first checks the extension (pkg/domain/infra/abi/quadlet.go, around line 44). A name with no supported extension returns an error, not "not found". So with the current helper, podman quadlet exists myapp would exit 125 instead of 1. My preference is to keep the full name requirement (the same names quadlet list shows), but I want to confirm that's what you want.

The issue says the command returns 1 when the quadlet doesn't exist. The REST test treats an unsupported extension as an input error (500, test/apiv2/36-quadlets.at:39). For the CLI, should an unsupported extension return 1 (not found) or the usual error exit 125?

i-OmSharma avatar Nov 13 '26 16:11 i-OmSharma