Thank you for your answer .
any reson why   Facter::Util::Resolution.
exec not working .
i don't see either when running factor on the client or on the puppet
server yaml file any record of fact named yaniv ?


On Tue, Aug 7, 2012 at 12:49 PM, Foster Rilindo <rili...@mac.com> wrote:

> Since you are directly executing a command, you really want to use the
> built-it Puppet function here:
>
> require 'facter'
> Facter.add("yaniv") do
>   setcode do
>        Facter::Util::Resolution.exec("cat /tmp/yanivf.txt")
>     end
> end
>
> There is probably some newlines that file that may not be immediately
> apparent. The above function takes care of that, plus path searching as
> well.
>
> On Aug 7, 2012, at 3:19 AM, Yaniv Fine <yanivf...@gmail.com> wrote:
>
> Hi Dan .
> thank you for your help and pointers .
>
>
> i need your advice pls .
> lets say i have /tmp/yanivf.txt
> inside i have a line testing
> when i run
>
> require 'facter'
> Facter.add("yaniv") do
>   setcode do 'cat /tmp/yanivf.txt'
>   end
> end
>
> and than i run facter i get nothing
>
> when i run
> export FACTER_yanivval=`cat /tmp/yanivf.txt`; facter
> all works fine .
> why facter.add doesnt work ?
>
>
> thank you
>
>
>
>
> On Mon, Aug 6, 2012 at 6:59 PM, Dan White <y...@comcast.net> wrote:
>
>> Let me re-answer that:
>>
>> Using the stdlib::facter-dot-d, I expect you are restricted to
>> /etc/facts.d
>>
>> However, if you look at the examples here (
>> http://puppetlabs.com/blog/facter-part-1-facter-101/ ), you can create
>> facts that reference files anywhere in the system.  The example shows using
>> a file at /etc/system_role to populate a fact.
>>
>> Looking at your original question again, it might be possible to create a
>> Ruby script to do what you want.
>>
>> Look through the examples in that blog entry and the two that follow it.
>>  It's all great stuff.
>>
>> “Sometimes I think the surest sign that intelligent life exists elsewhere
>> in the universe is that none of it has tried to contact us.”
>> Bill Waterson (Calvin & Hobbes)
>>
>> ----- Yaniv Fine <yanivf...@gmail.com> wrote:
>> > Can this be file in other path ?
>> > On Aug 6, 2012 4:20 PM, "Dan White" <y...@comcast.net> wrote:
>> >
>> > > I think you are trying to re-invent a wheel that is already in use.
>> > >
>> > > Consider:
>> > >
>> > >
>> http://puppetlabs.com/blog/module-of-the-week-puppetlabsstdlib-puppetlabs-standard-library-part-3/
>> > >
>> > > facter-dot-d; a simple way of pulling facts from external sources.
>> > >
>> > > From the docs:
>> > >
>> > > A simple little framework to get facts from external sources. You can
>> > > create files in /etc/facter/facts.d which can be text, yaml, json or
>> > > executables. In the case of executables it supports caching so you
>> only
>> > > need to run your expensive scripts every now and then.
>> > >
>> > > “Sometimes I think the surest sign that intelligent life exists
>> elsewhere
>> > > in the universe is that none of it has tried to contact us.”
>> > > Bill Waterson (Calvin & Hobbes)
>> > >
>> > > ----- Yaniv Fine <yanivf...@gmail.com> wrote:
>> > > > Hi experts .
>> > > >
>> > > > i would like to write a custom fact the will  add a fact to a
>> machine
>> > > yaml
>> > > > file
>> > > > i am a file /etc/file.conf
>> > > > inside this file a have many lines like
>> > > > value1 = test1
>> > > > value2 = test2
>> > > >
>> > > > i want to create a custom rb file that will grep test2 from  value2
>> > >  value
>> > > > from /etc/file.conf   , take the test2 and add it to a fact
>> > > >
>> > > > how can i achieve this ?
>> > > > thank you
>> > > >
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > You received this message because you are subscribed to the Google
>> > > Groups "Puppet Users" group.
>> > > > To view this discussion on the web visit
>> > > https://groups.google.com/d/msg/puppet-users/-/Zqakzj9PoBMJ.
>> > > > 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.
>> > > >
>> > >
>> > > --
>> > > 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.
>> > >
>> > >
>> >
>> > --
>> > 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.
>> >
>>
>> --
>> 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.
>>
>>
>
> --
> 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.
>
>
>  --
> 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.
>

-- 
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