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

Use modern os facts #964

Merged
merged 8 commits into from
Jan 18, 2021
Merged

Conversation

kenyon
Copy link

@kenyon kenyon commented Dec 20, 2020

This turned into a bigger change than I originally imagined...

Background: I'm developing a module using PDK and Litmus. My module has an option to use the backport version of the Debian package. During acceptance testing with the litmusimage/debian:10 Docker image, I found that a simple include apt::backports failed because puppetlabs-apt thought it wasn't running on Debian. This turned out to be because the lsb-release package wasn't installed. I noticed that, with Puppet 7 and Facter 4.0.47 anyway, the legacy OS facts aren't populated unless lsb-release is installed. However, the modern os fact structure is populated even without lsb-release. So rather than have my module ensure lsb-release is installed, I decided to update puppetlabs-apt, and this pull request is the result.

Removing this package dependency makes the module more robust and simpler to use.

Update: I see now that only Puppet 7 resolves the os fact properly without lsb-release installed, so I've updated this to still install that package for acceptance tests, so that testing on Puppets <7 still works, and updated the readme to note that it's not needed with Puppet 7.

I didn't figure out how to stop using osfamily in the apt_* custom facts and the apt_key provider. Not sure if that is even necessary.

There are a few other minor fixes in this PR, in individual commits for easier review.

@kenyon kenyon requested a review from a team as a code owner December 20, 2020 09:46
@codecov
Copy link

codecov bot commented Dec 20, 2020

Codecov Report

Merging #964 (45341ae) into main (406efe9) will decrease coverage by 0.38%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #964      +/-   ##
==========================================
- Coverage   72.24%   71.86%   -0.39%     
==========================================
  Files           5        5              
  Lines         263      263              
==========================================
- Hits          190      189       -1     
- Misses         73       74       +1     
Impacted Files Coverage Δ
lib/facter/apt_reboot_required.rb 75.00% <0.00%> (-25.00%) ⬇️
lib/facter/apt_updates.rb 85.24% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c5259f8...45341ae. Read the comment docs.

@kenyon kenyon force-pushed the use-modern-os-facts branch from dfa2f49 to 00feadf Compare December 20, 2020 11:02
@kenyon
Copy link
Author

kenyon commented Dec 20, 2020

I don't see why code coverage would change. 🤷‍♂️

@bastelfreak
Copy link
Collaborator

@kenyon I raised https://tickets.puppetlabs.com/browse/FACT-2906 to get lsb packages as dependency added

@sanfrancrisko sanfrancrisko self-assigned this Jan 4, 2021
@kenyon kenyon force-pushed the use-modern-os-facts branch 2 times, most recently from e7ff3d0 to f7d27cb Compare January 10, 2021 09:33
@kenyon
Copy link
Author

kenyon commented Jan 10, 2021

🛠️ rebased 🌪️

@carabasdaniel carabasdaniel self-assigned this Jan 11, 2021
@carabasdaniel
Copy link

Hi @kenyon,

This PR looks great, but can you please squash the commits and then I'll merge it.

Thanks

@kenyon kenyon force-pushed the use-modern-os-facts branch from f7d27cb to 45341ae Compare January 12, 2021 22:29
@kenyon
Copy link
Author

kenyon commented Jan 12, 2021

Hi @kenyon,

This PR looks great, but can you please squash the commits and then I'll merge it.

Thanks

Thanks. I did some squashing. I think the remaining commits stand on their own.

@carabasdaniel
Copy link

Hi @kenyon,

Thanks for your contribution, looks great! 👍

@carabasdaniel carabasdaniel merged commit 18c44ad into puppetlabs:main Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants