I agree with Steve comment but the point you guys are missing here it's a multi-tenant system and I'm getting hard time to visualize how a custom fact will handle the situation as the the same command will return different result for different databases, based on the client.
It does make difference in the sense as /etc/passwd is unique for given puppet agent but it's not when you running, e.g. ls ~/Documents|wc -l for different users on the same puppet agent. How you will do the with a custom fact? I'm glad to be educated. -S On Monday, February 1, 2016 at 2:31:08 PM UTC, jcbollinger wrote: > > > > 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/6f2110a4-8d7f-4829-a99d-7f64f544c6a1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.