-
Notifications
You must be signed in to change notification settings - Fork 18
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
Make it easy to test without legacy facts #38
Comments
There was a PR: #41 and now there's also voxpupuli/rspec-puppet-facts#143. Perhaps this should be combined. |
Note we configure the actual Facter implementation here: rspec-puppet/lib/rspec-puppet/adapters.rb Lines 240 to 260 in 612d8af
I think one question we should ask ourselves is how to transition the setting from here to rspec-puppet-facts: do we explicitly call some method here in the adapter, or respect a setting on rspec-puppet inside rspec-puppet-facts. Given we don't depend on rspec-puppet-facts here, I think calling something in the adapter is would be wrong. It's better to fix it in rspec-puppet-facts. |
rspec-puppet/lib/rspec-puppet/facter_impl.rb Lines 10 to 12 in 612d8af
ie it needs to support returning facts accessed with dot notation. |
In Puppet 8, core providers are being confined using facts fetched using 'dot-notation'. We need to support this style of lookup in our stub implementation. For example in `lib/puppet/provider/service/init.rb` ```ruby confine :true => begin os = Puppet.runtime[:facter].value(:operatingsystem).downcase # ... ``` was updated to ```ruby confine :true => begin os = Puppet.runtime[:facter].value('os.name').downcase # ... ``` See puppetlabs/puppet@82cef23 for Puppet 8 change. Relates to puppetlabs#38
In Puppet 8, core providers are being confined using facts fetched using 'dot-notation'. We need to support this style of lookup in our stub implementation. For example in `lib/puppet/provider/service/init.rb` ```ruby confine :true => begin os = Puppet.runtime[:facter].value(:operatingsystem).downcase # ... ``` was updated to ```ruby confine :true => begin os = Puppet.runtime[:facter].value('os.name').downcase # ... ``` See puppetlabs/puppet@82cef23 for Puppet 8 change. Relates to puppetlabs#38
In Puppet 8, core providers are being confined using facts fetched using 'dot-notation'. We need to support this style of lookup in our stub implementation. For example in `lib/puppet/provider/service/init.rb` ```ruby confine :true => begin os = Puppet.runtime[:facter].value(:operatingsystem).downcase # ... ``` was updated to ```ruby confine :true => begin os = Puppet.runtime[:facter].value('os.name').downcase # ... ``` See puppetlabs/puppet@82cef23 for Puppet 8 change. Relates to puppetlabs#38
@ekohl Should we add a task list to this issue description to try to figure out what needs to be done, where and in what order? (or maybe somewhere under vox's namespace where we can both edit it??) I dunno... I think we're currently looking at something like...
Later...
Notes: |
Overall I think that's pretty much what I wanted to write down as a plan, so certainly 👍
What do you mean by this? |
The recent commit on |
In https://groups.google.com/g/puppet-dev/c/hFIjgvOa5J0 @joshcooper wrote...
Specifically, will the "I think this is only safe to do in Puppet 8, because of the way modules use rspec-puppet & rspec-puppet-facts to stub provider suitability." statement still be true if we make the changes being planned? |
@alexjfisher the |
I'm no longer convinced that the pruning of facts should happen in rspec-puppet-facts as rspec-puppet itself sets some legacy facts by default and these need pruning too. |
Maybe this PR is the right direction instead? #53 |
Use Case
Puppet 7.21.0 gained the configuration option
include_legacy_facts
. It defaults to true but Puppet 8 will default to false. It would make future proofing of modules easier if you could already test in rspec-puppet withinclude_legacy_facts
set to false.Describe the Solution You Would Like
Add an option to rspec-puppet to use this.
Describe Alternatives You've Considered
It is very common to use rspec-puppet-facts and perhaps that should gain the option. Then FacterDB does need another set of facts for each OS and Facter version.
The text was updated successfully, but these errors were encountered: