On Friday, January 29, 2016 at 12:43:17 PM UTC-6, Sans wrote:
>
>
> Steve, how you doing?? It's been very long time.......
>
> The list-of-users was just an example.  The command that I actually wanna 
> run is [...]
>


It makes no difference.  Steve's answer was spot on: facts are *the* 
mechanism for conveying information about current node state to the 
master.  There are multiple mechanisms by which you can implement custom 
facts <https://docs.puppetlabs.com/facter/3.1/custom_facts.html>, some of 
them accommodating shell scripting quite directly 
<https://docs.puppetlabs.com/facter/3.1/custom_facts.html#external-facts>.

 

> I thought about the custom fact and I think I can work around it that way 
> but having something equivalent to inline_template()that I can run on the 
> fly is useful and simpler in this case.
>


You can use ERB on the client side to evaluate your custom fact if you 
really want to do, but I don't see what the gains you even in your revised 
example.  There, ERB is just a wrapper around a shell-out; it would be 
simpler to just implement that particular fact via a shell script, cutting 
Ruby and ERB out of the picture entirely.  Even if you used a traditional 
Ruby custom fact implementation, the ERB in that particular example would 
be needless, as you could instead just use the Ruby embedded inside, 
directly.

More generally, ERB is most useful for *formatting*.  If you find yourself 
wanting to do much formatting in your custom fact implementations then 
you're doing something wrong.  Neither of your examples so far actually 
exhibits that problem, however; instead, the ERB in them is altogether 
extraneous.


John

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/3517c3ad-2845-4872-8681-e4ff2d015bf9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to