>
>
> What do you mean, 'generate a custom value'? In what manner is a facter
> 'custom value' different from a return value in the surrounding Facter.add
> block? Why would code outside of a setcode block make someone in the know,
> as it were, uneasy?
>
>
>>  The value of the last expression in that block is returned as the value
>> for your custom fact.
>>
>
> Why? Which is to say, why does setcode exist at all and why is not the
> return value for the Facter.add block taken as the value for the fact? Of
> what special utility is setcode?
>


The phrase 'custom value' was a slip - I was referring to the "value of your
custom fact" and mistyped.

Check out the sourcecode for the setcode method in facter -->
https://github.com/puppetlabs/facter/blob/master/lib/facter/util/resolution.rb#L116-127
I believe you can also do something like:  setcode("/bin/uname -i")
and it
will set the value of your fact to whatever is returned by executing that
code (done by executing the code with the facter::util::resolution.exec
method).  If you pass a block to setcode (by using setcode do ... end), then
it executes the block and returns the value of the last expression in the
block.



>
> Ah, so it was merely a debugging step?
>

Absolutely.



>
> --
>>
>> Gary Larizza
>> Professional Services Engineer
>> Puppet Labs
>>
>> Join us for PuppetConf <http://bit.ly/puppetconfsig>, September 22nd and
>> 23rd in Portland, OR!
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Puppet Users" group.
>> To post to this group, send email to puppet-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> puppet-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>
>
>
> --
> Brian L. Troutwine
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>



-- 

Gary Larizza
Professional Services Engineer
Puppet Labs

Join us for PuppetConf <http://bit.ly/puppetconfsig>, September 22nd and
23rd in Portland, OR!

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to