On Tue, Sep 08, 2015 at 11:47:44AM -0700, Vince Skahan wrote:
>    I think I found a bug in facter in 3.8.2 but wanted to ask here before
>    opening a PL ticket.
> 
>    Basic description is that facter has different behaviors if you run it
>    without vs. with a fact specified.
> 
>    To recreate:
> 
>    # echo 'foo = bar' > /etc/facter/facts.d/foo.txt
>    # facter | grep foo
>    foo  =>  bar
>    # facter foo

The structured fact documentation does not have spaces between the fact name, 
the equals sign, and the fact value.

https://docs.puppetlabs.com/facter/2.4/custom_facts.html#structured-data-facts

I get the correct behaviour when I rename the fact file with the space in its 
name implied by the string 'foo = bar'. By using the space it appears you have 
created a fact named 'foo ' rather than 'foo'. You see that the value of the 
fact has a space in it too.

[root@cwh facts.d]# echo 'fact1 = foo' >fact1.txt
[root@cwh facts.d]# facter | grep fact1
fact1  =>  foo
[root@cwh facts.d]# facter | grep processorcount
physicalprocessorcount => 1
processorcount => 4
[root@cwh facts.d]# facter fact1

[root@cwh facts.d]# mv fact1.txt 'fact1 '.txt
[root@cwh facts.d]# ls -l fact1\ .txt
-rw-r--r-- 1 root root 12 Sep  8 16:14 fact1 .txt
[root@cwh facts.d]# facter 'fact1 '
 foo

>    #
>    Net effect is that if you have spaces around the = sign in your custom
>    fact definitions, the server doesn't match at all.  It seems to look up by
>    name, which returns nothing (or a blank line, or a space - it's hard to
>    tell which)
> 
>    Workaround is to have no spaces around the = sign, but I think this is a
>    bug needing fixing.  The behavior should be the same when you run "facter
>    | grep foo" and "facter foo" shouldn't it ?
> 
>    --
>    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 [1][email protected].
>    To view this discussion on the web visit
>    
> [2]https://groups.google.com/d/msgid/puppet-users/f56bf1f3-4d68-4c10-a662-ff578b0668dc%40googlegroups.com.
>    For more options, visit [3]https://groups.google.com/d/optout.
> 
> References
> 
>    Visible links
>    1. mailto:[email protected]
>    2. 
> https://groups.google.com/d/msgid/puppet-users/f56bf1f3-4d68-4c10-a662-ff578b0668dc%40googlegroups.com?utm_medium=email&utm_source=footer
>    3. https://groups.google.com/d/optout

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20150908202222.GA12431%40iniquitous.heresiarch.ca.
For more options, visit https://groups.google.com/d/optout.

Reply via email to