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

[Feat. Req.] Add option to support older podman versions? #45

Closed
cyqsimon opened this issue Jan 1, 2024 · 4 comments · Fixed by #46
Closed

[Feat. Req.] Add option to support older podman versions? #45

cyqsimon opened this issue Jan 1, 2024 · 4 comments · Fixed by #46
Labels
enhancement New feature or request
Milestone

Comments

@cyqsimon
Copy link

cyqsimon commented Jan 1, 2024

Many point-release distros may ship older versions of podman. It would be nice if the newest version of podlet can generate a quadlet file that's compatible with an older version of podman on demand with an option. Something like this:

podlet --compat=4.6 compose

On the technical side, I know of the obake crate that allows versioned structs. Perhaps this is something worth looking into, although I cannot say for sure how applicable it will be to this specific situation.

@k9withabone
Copy link
Member

k9withabone commented Jan 2, 2024

I'm not sure maintaining multiple versioned structs is the way to go here. It would add too much complexity and cognitive overhead.

I'll add this as a "best effort" feature. The struct representing the quadlet (at the moment quadlet::File and quadlet::Resource) will be changed in place, moving new options to PodmanArgs=. The generated quadlet may not be optimal. Additionally, an error may be returned when downgrading.

@k9withabone k9withabone added the enhancement New feature or request label Jan 2, 2024
@k9withabone k9withabone added this to the v0.2.4 milestone Jan 2, 2024
@cyqsimon
Copy link
Author

cyqsimon commented Jan 3, 2024

I can perhaps send a PR for this. Will look into this over the weekend.

@k9withabone
Copy link
Member

I actually mostly finished it already. Wasn't as hard as I thought it would be. I'll post a PR later today or tomorrow. Once I post it, when you get the chance, could you take a look at it to see if it fits your expectations?

@cyqsimon
Copy link
Author

cyqsimon commented Jan 3, 2024

That's awesome. Thanks for the great work. I'm happy to help with the review.

k9withabone added a commit that referenced this issue Jan 3, 2024
Setting a lower podman version will downgrade the quadlet's
compatibility. Will return an error if an incompatible quadlet option is
used.

Implemented as an in-place, one-way transformation of `quadlet::File`
and its parts. That way, there is less complexity than dealing with
multiple versions of each quadlet resource type.

`--podman-version` has aliases `--compatibility` and `--compat`.

Also enabled `wrap_help` feature of clap.

Closes: #45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants