puppetlabs / puppetlabs-apt

Puppet module to help manage Apt
https://forge.puppetlabs.com/puppetlabs/apt
Apache License 2.0
216 stars 463 forks source link

Add support for deb822 APT sources #1167

Open jps-help opened 4 months ago

jps-help commented 4 months ago

Summary

Adds a new defined type, apt::source_deb822, and corresponding EPP template for managing deb822 APT sources.

Works alongside the existing apt::source type.

TO DO

Additional Context

Related Issues (if any)

Mention any related issues or pull requests.

Checklist

jps-help commented 3 months ago

Inline ASCII GPG keys are still not working, but not necessary for an initial implementation.

Same with generating apt::keyring resources from within the apt::source_deb822 resource. But I don't really think this is necessary at all since you can just create the keyring resource separately.

Spec tests are done.

I'm happy with the state of this PR. Happy to hear people's thoughts/suggestions.

bastelfreak commented 3 months ago

@jps-help thanks for the PR! Can you please rebase against main to get rid of the merge commit?

jamesps-ebi commented 3 months ago

@jps-help thanks for the PR! Can you please rebase against main to get rid of the merge commit?

The fork has been rebased. Should be good to go.

jamesps-ebi commented 1 month ago

Woops... I have accidentally reset my fork force pushed while testing another PR.

Luckily I still have my original deb822 branch. I'll fix and push again.

jps-help commented 3 weeks ago

What exactly is your reason to add an additional resource instead of extending the apt::source resource

I think the main reason is just because of how different the two styles are. If you look at the current apt::source, many of the parameters take a single value, whereas, with deb822 parameters like suites and components can accept an array of values. Sure we could just have one .sources file per suite or component of a repo, like with the current method, but I think it defeats the purpose of the newer deb822 style.

There might be a way we can extend the current type, I'm open to suggestions. My main focus was simply to add the new functionality without breaking the existing type at all.

rrotter commented 1 week ago

I'd suggest keeping this under apt::source for several reasons:

There might be a way we can extend the current type, I'm open to suggestions.

Indeed, I'd suggest adding an Enum['legacy','deb822'] that probably defaults to 'legacy' for now. I like the idea of using the modern names for the fields (suites vs release, etc), but we could have both, and have one be an alias for the other. Could accept either an array or a string in the new name and continue accepting only a string in the old field name. That way there's the option of taking advantage of everything new that deb822 offers, but also the option of just switching over with at little change as possible.

edit: also, using any of the new field names should implicitly force deb822, and trying to combine the new fields with the legacy source would be an error. See the handling of keyrings in the apt::source: key field for an example.

jps-help commented 1 week ago

@rrotter All very good points. Let me take this back to the drawing board and try to implement with all these suggestions.

I think we will need a lot of new logic to handle the switch between the two versions, but in the end hopefully will be a better experience!

jps-help commented 1 week ago

Okay... I have merged some new changes that integrate the deb822 functionality into the existing apt::source type.

This is very much a work-in-progress and has several points to consider:

Comments are greatly appreciated.

TLDR; I used a case statement to separate the functionality and added a new Enum parameter to control it.

Also I left the separate manifest for apt::source_deb822 but can clean that up later.