Skip to content

Add facter/openfact configuration support#978

Open
jay7x wants to merge 1 commit intotheforeman:masterfrom
jay7x:facter
Open

Add facter/openfact configuration support#978
jay7x wants to merge 1 commit intotheforeman:masterfrom
jay7x:facter

Conversation

@jay7x
Copy link

@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
contain puppet::agent::config
contain puppet::agent::service

if $puppet::facter_config.length > 0 {
Copy link
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
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
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
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
@jay7x jay7x marked this pull request as ready for review February 10, 2026 23:55
@jay7x
Copy link
Author

jay7x commented Feb 11, 2026

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

@ikonia
Copy link

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

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

Successfully merging this pull request may close these issues.

Add basic facter.conf creation and management to module

4 participants