Skip to content

Add facter/openfact configuration support#978

Merged
evgeni merged 1 commit intotheforeman:masterfrom
jay7x:facter
Mar 12, 2026
Merged

Add facter/openfact configuration support#978
evgeni merged 1 commit intotheforeman:masterfrom
jay7x:facter

Conversation

@jay7x
Copy link
Copy Markdown
Contributor

@jay7x jay7x commented Feb 6, 2026

This PR is mostly based on idea of @vchepkov and implementation of @ikonia drafted in #950.

Closes #947

@jay7x jay7x marked this pull request as draft February 6, 2026 10:12
Comment thread manifests/agent.pp
contain puppet::agent::config
contain puppet::agent::service

if $puppet::facter_config.length > 0 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work?

Suggested change
if $puppet::facter_config.length > 0 {
unless empty($puppet::facter_config) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As $puppet::facter_config cannot be undef and is represented by Hash, so this should work (at least I'm always using it instead of emtpy() which is stdlib function).

➜ ~ puppet apply -e '$a={}; $b={foo=>"bar"}; notice $a.length; notice $b.length'
Notice: Scope(Class[main]): 0
Notice: Scope(Class[main]): 1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example should be better:

➜ ~ puppet apply -e '{}.with |Struct[{Optional[foo]=>String}] $x| { notice $x.length }'
Notice: Scope(Class[main]): 0
➜ ~ puppet apply -e '{foo=>"bar"}.with |Struct[{Optional[foo]=>String}] $x| { notice $x.length }'
Notice: Scope(Class[main]): 1

Copy link
Copy Markdown
Contributor Author

@jay7x jay7x Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can change if empty() is preferred from a style perspective though :)

@jay7x jay7x force-pushed the facter branch 5 times, most recently from 46dddba to 757527d Compare February 9, 2026 01:23
Comment thread spec/type_aliases/facter/config/ttl_spec.rb Outdated
Comment thread types/facter/config/cli.pp Outdated
Comment thread types/facter/config/facts.pp Outdated
Comment thread types/facter/config/global.pp Outdated
Comment thread types/facter/config/ttl.pp Outdated
Comment thread types/facter/config.pp Outdated
@jay7x jay7x marked this pull request as ready for review February 10, 2026 23:55
@jay7x
Copy link
Copy Markdown
Contributor Author

jay7x commented Feb 11, 2026

JFYI, I tested this on my WIP puppetserver with bolt apply, and it works fine.

@ikonia
Copy link
Copy Markdown

ikonia commented Feb 15, 2026

thank you for taking this forward, I was struggling to get rid of the need for hocon_setting and hitting a wall

@evgeni evgeni merged commit c87087a into theforeman:master Mar 12, 2026
19 checks passed
evgeni added a commit to evgeni/foreman-installer that referenced this pull request Mar 17, 2026
theforeman/puppet since [1] uses syntax that can only be parsed by kafo
7.7+ [2]

[1] theforeman/puppet-puppet#978
[2] theforeman/kafo#391
evgeni added a commit to theforeman/foreman-installer that referenced this pull request Mar 17, 2026
theforeman/puppet since [1] uses syntax that can only be parsed by kafo
7.7+ [2]

[1] theforeman/puppet-puppet#978
[2] theforeman/kafo#391
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add basic facter.conf creation and management to module

5 participants