Issue #7192 has been updated by James Turnbull.

Status changed from Unreviewed to Needs Decision
Assignee set to Nigel Kersten

Looks like a regression.
----------------------------------------
Bug #7192: 'facter customfactname' doesn't work, but 'facter |grep 
customfactname' does.
https://projects.puppetlabs.com/issues/7192

Author: Greg Retkowski
Status: Needs Decision
Priority: Normal
Assignee: Nigel Kersten
Category: 
Target version: 
Keywords: 
Branch: 
Affected Facter version: 1.5.9


I've found a bug where custom facts that I have aren't displayed if I invoke 
'facter factname' - however if I invoke 'facter |grep factname' they appear. 
Afaict this is a regression to old behaviour, as versions prior to 1.5.8 would 
not show custom fact names, 1.5.8 does show custom fact names, and 1.5.9 now 
does not show custom fact names.

I've narrowed it down to a call Factor.to_hash - it was always called in 1.5.8, 
but only called when no fact names are given in 1.5.9. Here's my irb session 
that shows the behaviour..
<pre>
irb(main):001:0> require 'facter'
=> true
irb(main):002:0> Facter.fact('site_type')
=> nil
irb(main):003:0> Facter.to_hash;true
=> true
irb(main):004:0> Facter.fact('site_type')
=> #<Facter::Util::Fact:0x2b4852ae8f38 @ldapname="site_type", @value="support", 
@searching=false, @name=:site_type, 
@resolves=[#<Facter::Util::Resolution:0x2b4852ae8df8 @value=nil, 
@suitable=true, @confines=[], @name=:site_type, 
@code=#<Proc:0x00002b48533783d8@/var/lib/puppet/lib/facter/facter_machdb.rb:55>,
 @timeout=0>]>
</pre>

In facter.rb, around line 97, methods are added to the class; certain methods 
(list, to_hash) invoke 'collection.load_all' where other methods (fact, value) 
don't invoke collection.load_all. My custom facts only appear to load when 
collection.load_all is invoked.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to