Skip to content

Quadlet installation code refactoring#28860

Open
l0rd wants to merge 1 commit into
podman-container-tools:mainfrom
l0rd:refactor/quadlet-applications-with-fix
Open

Quadlet installation code refactoring#28860
l0rd wants to merge 1 commit into
podman-container-tools:mainfrom
l0rd:refactor/quadlet-applications-with-fix

Conversation

@l0rd

@l0rd l0rd commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

This is a follow-up of #28335 with some improvements:

  • Clean up the code to install quadlets and make it more consistent (always fail for non-quadlet files without --application)
  • Fix podman quadlet install output message (see refactor: podman quadlet sub-command #28335 (comment))
  • Fix libpod quadlet tests
  • Update libpod quadlet endpoint documentation

Checklist

Ensure you have completed the following checklist for your pull request to be reviewed:

  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by signing all
    commits. (git commit -s). (If needed, use git commit -s --amend). The author email must match
    the sign-off email address. See CONTRIBUTING.md
    for more information.
  • Referenced issues using Fixes: #00000 in commit message (if applicable)
  • Tests have been added/updated (or no tests are needed)
  • Documentation has been updated (or no documentation changes are needed)
  • All commits pass make validatepr (format/lint checks)
  • Release note entered in the section below (or None if no user-facing changes)

Does this PR introduce a user-facing change?

Changes to Quadlet applications

@github-actions github-actions Bot added the kind/api-change Change to remote API; merits scrutiny label Jun 4, 2026
@l0rd l0rd mentioned this pull request Jun 4, 2026
6 tasks
@l0rd l0rd force-pushed the refactor/quadlet-applications-with-fix branch 3 times, most recently from 3599897 to 5703e04 Compare June 8, 2026 11:27
@l0rd l0rd changed the title Changes to Quadlet applications Quadlet installation code refactoring Jun 8, 2026
@l0rd l0rd marked this pull request as ready for review June 8, 2026 11:33
@l0rd

l0rd commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@simonbrauner @inknos PTAL

Comment thread pkg/domain/infra/abi/quadlet.go Outdated
Comment thread pkg/api/server/register_quadlets.go
Comment thread pkg/domain/infra/abi/quadlet.go Outdated
Comment thread pkg/domain/infra/abi/quadlet.go Outdated
@l0rd l0rd force-pushed the refactor/quadlet-applications-with-fix branch 2 times, most recently from 1661876 to 24903e0 Compare June 8, 2026 14:01
@packit-as-a-service

Copy link
Copy Markdown

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@inknos inknos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 nits and a clarification, then LGTM

Comment on lines 301 to +304
// First, validate that the source path exists and is a file
stat, err := os.Stat(path)
_, err := os.Stat(srcPath)
if err != nil {
return "", fmt.Errorf("quadlet to install %q does not exist or cannot be read: %w", path, err)
}
if stat.IsDir() {
dirs, err := os.ReadDir(path)
if err != nil {
return "", err
}

for _, d := range dirs {
nInstallDir := filepath.Join(installDir, destName)
err := os.MkdirAll(nInstallDir, 0o755)
if err != nil {
return "", err
}

_, err = ic.installQuadlet(
ctx,
filepath.Join(path, d.Name()), // path
d.Name(), // destName
nInstallDir, // installDir
replace)
if err != nil {
return "", err
}
}
return path, nil
return "", fmt.Errorf("quadlet to install %q does not exist or cannot be read: %w", srcPath, err)

@inknos inknos Jun 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit. this comment is outdated

Edit: got me confused when I was reading the code, had to go through it twice :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Which comment is outdated?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

// First, validate that the source path exists and is a file

code seemed just clear as is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'll be off in the next days, so to be clear, this is non blocking and the PR LGTM in the current state. waiting for tests only

Comment thread pkg/domain/infra/abi/quadlet.go Outdated
Comment thread pkg/domain/infra/abi/quadlet.go Outdated
- Cleanup the code to install quadlets
- Fix `podman quadlet install` output message (see podman-container-tools#28335 (comment))
- Update libpod quadlet endpoint documentation

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
@l0rd l0rd force-pushed the refactor/quadlet-applications-with-fix branch from 24903e0 to 9890a3b Compare June 8, 2026 15:13

@simonbrauner simonbrauner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Checked #28335 (comment), it is fixed.

Added 2 comments, otherwise, LGTM

Comment on lines +132 to +137
defer func() {
if r != nil {
r.Body.Close()
}
if tmpFile != nil {
tmpFile.Close()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This gets called only once at the end of QuadletInstall, right? So if there are multiple URLs in quadletURLs, the r/tmpFile contains values from the last iteration of the foreach cycle that follows, so only those get Closed.

// If toInstall is a single file with a supported extension, execute the original logic
installedPath, err := ic.installQuadlet(ctx, toInstall, filepath.Base(toInstall), installDir, options.Replace)
// Install the quadlet from the temporary file
destName := quadlet.name + quadlet.extension

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

$ tree postgres-17-test-6
postgres-17-test-6
└── a
    ├── A.container
    └── test.quadlets

2 directories, 2 files

$ podman quadlet install postgres-17-test-6 --application 6
/home/sbrauner/.config/containers/systemd/6/a/A.container
/home/sbrauner/.config/containers/systemd/6/fromquadlets.container

There is an inconsistency on install destination.

For .quadlet files, the quadlets are installed to the path they were at (a/).

But for .quadlets files, the quadlets are installed to ~/.config/containers/systemd/applicationName, independently on their location within the application file structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/api-change Change to remote API; merits scrutiny

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants