I think it is a call from the facter API that let's you define the
code to use to get the value for that certain fact you are defining.
>From what I know, it let's you use just ruby code. But from that you
can call bash code too.

For example, you would like a new fact that gives you back your
current shell from your ENV. Add a new .rb file under your "module/
$module_name/lib/facter/" directory:

Facter.add("shell") do
   setcode do
      %x{echo $SHELL}
   end
end

the %x is ruby for execute this shell command.

Now when you run facter you should you have this new fact called
"shell".

On Dec 8, 4:50 am, "Baker, Luke" <bake...@missouri.edu> wrote:
> I see 'setcode' quite a bit in facter definitions - what does this do / mean?
>
> --Luke Baker

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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