Ask Your Question
0

custom fact from module

asked 2016-04-22 06:15:29 -0500

jdripper gravatar image

Hello,

I'm quite new to puppet.

I am trying to add a custom fact from a module. My debug output looks like this :

puppet agent --test --debug --server=masterserver > /tmp/pout.txt
[root@haproxy1 ~]# grep tmproduct /tmp/pout.txt

Debug: /File[/opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb]/seluser: Found seluser default 'system_u' for /opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb
Debug: /File[/opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb]/selrole: Found selrole default 'object_r' for /opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb
Debug: /File[/opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb]/seltype: Found seltype default 'lib_t' for /opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb
Debug: /File[/opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb]/selrange: Found selrange default 's0' for /opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb
Debug: Loading facts from /opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb
Info: Facter: loading custom facts from /opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb.
Debug: Facter: fact "tmproduct" has resolved to "sys".

Which seems to look good. However when I try facter it doens't seem to be there : facter | grep -i tmproduct Gives me nothing.

cat /opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb
Facter.add(:tmproduct) do
        setcode do
                fqdn = Facter.value(:fqdn)
                fqdn = fqdn.split('.')
                if fqdn.length > 1
                        fqdn[1]
                end
        end
end

Any ideas on what I'm doing wrong ?

TIA

edit retag flag offensive close merge delete

Comments

Forgot to add, I'm on puppet 4.4

jdripper gravatar imagejdripper ( 2016-04-22 06:28:10 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-04-22 16:27:35 -0500

lupin gravatar image

Do a facter -p tmpproduct , -p shows the custom facts.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-04-22 06:15:29 -0500

Seen: 257 times

Last updated: Apr 22 '16