Skip to content

Commit 0108ce7

Browse files
quadlet: add Pod field to quadlet list output
Fixes: #27121 Signed-off-by: codynguyen-dev <[email protected]>
1 parent 020a597 commit 0108ce7

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

pkg/domain/entities/quadlet.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ type ListQuadlet struct {
4141
// If multiple quadlets were installed together they will belong
4242
// to common App.
4343
App string
44+
// Pod is the name of the pod this quadlet belongs to
45+
Pod string
4446
}
4547

4648
// QuadletRemoveOptions contains parameters for removing Quadlets

pkg/domain/infra/abi/quadlet.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,21 @@ func (ic *ContainerEngine) QuadletList(ctx context.Context, options entities.Qua
465465
if ok {
466466
appName = value
467467
}
468+
469+
// Parse the unit file to extract Pod= from the [Container] section
470+
podName := ""
471+
unitFile, err := parser.ParseUnitFile(path)
472+
if err == nil {
473+
// LookupLast returns the last value if Pod= is specified multiple times
474+
value, _ := unitFile.LookupLast("Container", "Pod")
475+
podName = value
476+
}
477+
468478
report := entities.ListQuadlet{
469479
Name: filepath.Base(path),
470480
Path: path,
471481
App: appName,
482+
Pod: podName,
472483
}
473484

474485
serviceName, err := getQuadletServiceName(path)

0 commit comments

Comments
 (0)