Hi,

this makes me cringe a little :-)

You're both not completely off track, but then there's much better option.

As custom facts always run from a Puppet context, you have access to
Puppet's own API. Say a fact needs to incorporate the value of the
'server' setting in some way:

setcode do
  server_name_setting = Puppet['server']
  # ... code that uses the value
end

HTH,
Felix

On 10/17/2014 06:19 PM, Craig White wrote:
> It would seem to me that I would not eagerly use another gem to obtain
> information from a file when ruby has File and vast string compare
> options but the choice is yours. Then there are tools like augeas (sp?).
>
> Gems can be managed as a package using the gem provider so it's fairly
> easy to get puppet clients to install gems and note that facts run
> first so the first pass, the fact will not have information as the gem
> would likely have to be installed and the second pass, the fact can be
> derived.
>
> On Friday, October 17, 2014 8:03:36 AM UTC-7, Mark Rosedale wrote:
>
>     Hello,
>
>     I'm looking to implement a custom fact that tells my puppet config
>     if a machine is configured a certain way. What I want to do is
>     parse the configuration's ini file and see if a certain setting is
>     turned on or off. I'm looking at using the ruby gem inifile
>     <https://rubygems.org/gems/inifile>to do this. 
>
>     Couple of questions. I'm assuming that facts, unlike functions,
>     are run on the node, correct? So if that is the case what is the
>     best way to distribute this gem to all hosts? 
>
>     Final question. Am I barking up the wrong tree trying to use this
>     library to parse an ini file? Has anyone else done this type of
>     thing? 
>
>

-- 
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/545A9689.2030801%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.

Reply via email to