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

Allow modules to export custom fact values #127

Open
bodgit opened this issue Jun 9, 2021 · 1 comment
Open

Allow modules to export custom fact values #127

bodgit opened this issue Jun 9, 2021 · 1 comment

Comments

@bodgit
Copy link
Contributor

bodgit commented Jun 9, 2021

I'm using the service_provider fact from the stdlib module in my own modules. Because this fact won't be in facterdb I have to provide values for it. Now, I can do this using add_custom_fact :service_provider, ->(os, facts) { ... } however at least for this fact, the logic can be quite cumbersome. I also have to duplicate this logic across every module that uses this same fact.

It would be handy if (somehow) a module that provides a custom fact also exports some example values for use in tests split by OS which could then be picked up by rspec-puppet-facts. I'm not sure how it would work, but given every module dependency is available under spec/fixtures/modules/* during a test run some well-defined location in each module could be used. So stdlib would have example values that on for example, RHEL6, service_provider is init, on RHEL7 its systemd, plus all of the other OS values, etc.

I found voxpupuli/facterdb#49 which is about the package_provider fact, but it's the same problem.

@ekohl
Copy link
Member

ekohl commented Jan 30, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants