-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
Remove Legacy Facts #266
Remove Legacy Facts #266
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to its size this is hard to review. Would it make sense to have a commit that removes Facter < 3?
I also wonder if Facter 3 had all the non-legacy facts.
I'd even consider dropping all Facter < 3.14.
I now see you have a commit that does that. It's a bit tricky to see. Something I do miss is the change to |
Good catch, it looks like I |
Would something in |
It's only a default in Puppet 8 to not have legacy facts. Presumably some people will be happy to turn them back on, so I think I'd prefer if this was done elsewhere if possible??? |
I'm thinking something like... RSpec.configure do |c|
c.legacy_facts = false
end (or we could default to |
In here somewhere??? https://github.com/voxpupuli/rspec-puppet-facts/blob/1418bca958049060a77dd49f10a9a298d15dc438/lib/rspec-puppet-facts.rb#L172-L173 [RspecPuppetFacts.legacy_facts].each { |fact| facts.delete(fact) } unless opts[:legacy_facts]) |
When I was thinking about this problem I actually thought of creating 2 fact sets: one with and one without legacy facts. Then in RspecPuppetFacts you would create an option to select either one or the other. My biggest worry was performance, given it's already rather slow due to its size. Nowadays it's mitigated by having a cache, but it's still slow. So what I'd consider is making it a completely new fact set that's only available opt-in. Any thoughts on that? |
I thought it was probably easier to conditionally just drop the keys that are legacy facts? It's a published fixed list that isn't about to change. |
While that's true, I'm a bit hesitant in generating data while in my head the aim of this is to represent what the real code does. |
Actually it's a little bit more involved. There are some legacy facts that are dynamically generated, eg. https://www.puppet.com/docs/puppet/7/core_facts.html#ipaddress-interface etc. |
Also worth bearing in mind that rspec-puppet-facts currently searches facterdb based on legacy facts. https://github.com/voxpupuli/rspec-puppet-facts/blob/master/lib/rspec-puppet-facts.rb would need a complete overhaul before dropping legacy facts here. |
Something like this perhaps?? voxpupuli/rspec-puppet-facts#143 |
24d6302
to
1e2cc2a
Compare
That's weird - I thought I pushed to my fork - how does it show up here?
EDIT: I figured out the git client "magic" that made this happen and I will make sure it doesn't happen again. |
e43e75e
to
b7d2e17
Compare
Since I accidentally rebased this, it should be easier to read now. |
proposal: the next major release drops support for facter 3 and older and some EoL OS. For the major release after that should we update get_facts.sh to remove all the legacy facts? Or should we do this already in the next major? puppet-lint has a plugin for legacy facts since some time now that's rolled out by default in PDK and at Vox Pupuli. I'm fine with dropping the legacy facts already. |
I think deprecating it in the next major and removing it the major after that can make sense, depending on the timeline. Do we know when Puppet 7 is going EOL? While not strictly tied to it, it makes sense to me. |
Puppet 7 lifecycle is related to the PE lifecycle: https://www.puppet.com/products/puppet-enterprise/support-lifecycle PE 2021 contains Puppet 7:
|
I suggest wo do a major release now and mention in the README.md that legacy facts are deprecated and will be removed in the next major release. And when Puppet 7 is EoL we do another major release without legacy facts. |
As someone who has the server infrastructure provided by another team in our org, it's to early for me now :( |
how does that relate to this change? Do they also provide puppet code with legacy facts? |
sadly yes. But mostly I don't know when I will be able to switch to puppet 8 |
Keep in mind that the legacy facts are legacy since Puppet 5 or 6 and since that time the new ones are available. Just puppet 8 finally disables the legacy facts by default (but you can reenable them). |
We (Vox Pupuli) did that a long time ago and so does the pdk since some time. |
The longer this sits, the more I think it should be two separate PRs - one to remove the code to generate the legacy facts and a separate one after that one is merged that actually removes the factsets. That will make this easier to merge. Any objections? |
We made the 2.0.0 release that announced the legacy fact deprecation. I think we can now tackle this and work on the 3.0.0 release which removes the lagacy facts. |
Just speaking from my own opinion, I think this is a good change to get in. |
@smortex do you have a chance to rebase/redo this PR? I would like to then merge it. |
8877cb0
to
6184373
Compare
Luckily I had the original branch and could cherry-pick / adjust / regenerate / skip commits 😁. |
selinux_enforced | ||
selinux_policyversion | ||
serialnumber | ||
sp_boot_mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay I've never seen those sp_* facts before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hehe, me neither! Looks like sp stand for system_profiler and is something related to MaxOSX 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jep, its macOS stuff... its now collected as system_profiler
structured fact.
spec/facts_spec.rb
Outdated
# those are used in newer rspec-puppet-facts versions | ||
# by ensuring those facts exists, we can drop a huge amount of logic in rspec-puppet-facts | ||
it 'contains the mandatory OS facts' do | ||
expect(content['os']['release']['major']).to not_be_nil.and not_be_empty | ||
expect(content['os']['name']).to not_be_nil.and not_be_empty | ||
expect(content['os']['hardware']).to not_be_nil.and not_be_empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you maybe keep those checks? we rely on those in rspec-puppet-facts and assume they exist. And there were situations in the past where factsets were provided for operating systems that aren't 100% supported and those facts were missing or null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I think that the initial code was looking for the legacy facts, and after rebasing I misread the conflicts that changed them to os.xxx facts and removed them by mistake.
Reintroduced, but I kept the check that ensure legacy facts are not found.
6184373
to
513e70e
Compare
selinux_enforced | ||
selinux_policyversion | ||
serialnumber | ||
sp_boot_mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jep, its macOS stuff... its now collected as system_profiler
structured fact.
Puppet 8 defaults to not providing Legacy Facts [1]. In order for our tests to be relevant, we should not provide these facts. We also had special instructions to ask contributors to add these legacy facts which are now obsolete. As a baseline, do not provide any legacy facts. Adjust references to legacy fact to use non deprecated and still relevant ones in CI, and provide a script that can asists us in updating the existing factsets. [1]: https://github.com/puppetlabs/puppet/wiki/Puppet-8-Compatibility#legacy-facts
This is the result of: ``` bundle exec bin/legacy-facts-striper facts/*/*.facts ```
Remove the `--show-legacy` option and prefer long options to the short ones.
513e70e
to
f38c29a
Compare
Puppet 8 defaults to not providing Legacy Facts 1. In order for our
tests to be relevant, we should not provide these facts. We also had
special instructions to ask contributors to add these legacy facts which
are now obsolete.
As a baseline, do not provide any legacy facts. Adjust references to
legacy fact to use non deprecated and still relevant ones in CI, and
provide a script that can asists us in updating the existing factsets.