External Facts in <MODULEPATH>/<MODULE>/facts.d/

155 views
Skip to first unread message

Dan White

unread,
Feb 9, 2015, 11:41:50 AM2/9/15
to Puppet Users Mailing List
Puppet 3.7.3
Facter 2.3.0
running on RHEL 6

Reference: https://docs.puppetlabs.com/facter/2.2/custom_facts.html#fact-locations

I put a simple fact_file.txt in one of my modules to try this new feature.
When I run puppet agent, I see the fact file deployed to /var/lib/puppet/facts.d/
However, I cannot get it to come out on a command line.

Here's the text file:

patch_fact_1=hello
patch_fact_2=there
patch_fact_3=every
patch_fact_4=one

(Module name is "patch")

facter -p patch_fact_1 returns a blank line

# facter -p patch_fact_1 --debug
Found no suitable resolves of 1 for ec2_metadata
value for ec2_metadata is still nil

And a full "facter -p" list does not show my 4 new facts
I am using /etc/facter/facts.d thru stdlib.  Do the two not play nice in the same puppet-sandbox ?

I tried restarting the puppetmaster and re-running the agent - no change.
I copied the file to /etc/facter/facts.d/ , prefixing the file name and all the fact names with "other_" to keep them separate.  The "other_" facts appeared immediately (no surprise), but the originals remain unavailable.

A clue or two, please ?
“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.”  (Bill Waterson: Calvin & Hobbes)

Felix Frank

unread,
Mar 5, 2015, 5:26:00 PM3/5/15
to puppet...@googlegroups.com
Hi Dan,

interesting, I think I can reproduce, with facter 2.4.1. Might be a bug.

I observe `puppet agent` opening my $vardir/facts.d files (through
strace), but not `facter -p`.

Cheers,
Felix

Dan White

unread,
Mar 5, 2015, 5:56:23 PM3/5/15
to Puppet Users Mailing List
Thank for the reminder, Felix
I figured out what I was missing:

The facts show up in a puppet manifest with no problem, but to get them to show on the facter command line, you need to add :

--external-dir=/var/lib/puppet/facts.d/

So, if I do it this way:

[user ]# facter --external-dir=/var/lib/puppet/facts.d/ patch_fact_1
hello

I get the response I was looking for.

And many thanks for the straight line "Might be a bug" which lets me say:

It is not a bug. It is an Undocumented Feature :D
> --
> You received this message because you are subscribed to the Google Groups "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/54F8D7E8.5010103%40Alumni.TU-Berlin.de.
> For more options, visit https://groups.google.com/d/optout.

“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.”
Bill Waterson (Calvin & Hobbes)

Felix Frank

unread,
Mar 5, 2015, 6:08:22 PM3/5/15
to puppet...@googlegroups.com
On 03/05/2015 11:55 PM, Dan White wrote:
--external-dir=/var/lib/puppet/facts.d/ 

Ah. Good catch!


It is not a bug.  It is an Undocumented Feature :D

Hah! Well I'm not convinced. UX bugs are still issues.

Cheers,
Felix

Josh Cooper

unread,
Mar 5, 2015, 6:31:32 PM3/5/15
to puppet...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Note that facter --puppet is deprecated, because it introduces a cyclical dependency between puppet and facter, and the same functionality can be accomplished using `puppet facts find <hostname>`, or more succinctly `puppet facts find .`

In 4.0, it's just `puppet facts find` thanks to Erik's contribution in https://tickets.puppetlabs.com/browse/PUP-3698

Josh

--
Josh Cooper
Developer, Puppet Labs

PuppetConf 2015 is coming to Portland, Oregon! Join us October 5-9.
Register now to take advantage of the Early Adopter discount save $349!

Johan De Wit

unread,
Mar 6, 2015, 1:51:28 AM3/6/15
to puppet...@googlegroups.com

On 06/03/15 00:31, Josh Cooper wrote:


On Thu, Mar 5, 2015 at 3:07 PM, Felix Frank <Felix...@alumni.tu-berlin.de> wrote:
On 03/05/2015 11:55 PM, Dan White wrote:
--external-dir=/var/lib/puppet/facts.d/ 

Ah. Good catch!

It is not a bug.  It is an Undocumented Feature :D

Hah! Well I'm not convinced. UX bugs are still issues.

Cheers,
Felix
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/54F8E1C2.7060601%40Alumni.TU-Berlin.de.

For more options, visit https://groups.google.com/d/optout.

This issue is covered in https://tickets.puppetlabs.com/browse/FACT-696.

Note that facter --puppet is deprecated, because it introduces a cyclical dependency between puppet and facter, and the same functionality can be accomplished using `puppet facts find <hostname>`, or more succinctly `puppet facts find .`

In 4.0, it's just `puppet facts find` thanks to Erik's contribution in https://tickets.puppetlabs.com/browse/PUP-3698

Josh


just in time, did notice this behaviour yesterday with PE3.7.2 :)

Grts



--
Josh Cooper
Developer, Puppet Labs

PuppetConf 2015 is coming to Portland, Oregon! Join us October 5-9.
Register now to take advantage of the Early Adopter discount save $349!
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

-- 
Johan De Wit

Open Source Consultant

Red Hat Certified Engineer              (805008667232363)
Puppet Certified Professional 2013/2014 (PCP0000006)
Puppet Certified Intstructor 
blog : http://johan.koewacht.net/
_________________________________________________________
 
Open-Future                 Phone     +32 (0)2/255 70 70
Zavelstraat 72              Fax       +32 (0)2/255 70 71
3071 KORTENBERG             Mobile    +32 (0)474/42 40 73
BELGIUM                     http://www.open-future.be
_________________________________________________________
 

Upcoming Events:

Puppet Fundamentals | http://www.open-future.be/puppet-fundamentals-training-16th-till-18th-march

Puppet Architect | http://www.open-future.be/puppet-architect-training-19th-till-20th-march

Puppet Practitioner | http://www.open-future.be/puppet-practitioner-training-14th-till-16th-april

Linux Training | http://www.open-future.be/linux-training-20th-till-24th-april

Bacula Administrator 1 | http://www.open-future.be/bacula-administrator-i-training-28th-till-30th-april

Zabbix Certified Specialist | http://www.open-future.be/zabbix-certified-specialist-training-4th-till-6th-may

Zabbix Certified Professional | http://www.open-future.be/zabbix-certified-professional-training-7th-till-8th-may

Subscribe to our newsletter: http://eepurl.com/BUG8H


Reply all
Reply to author
Forward
0 new messages