Hey, thanks for the examples Luke!  I am looking at them now.

--------------------------
Warron French


On Thu, Mar 30, 2017 at 8:31 AM, Luke Bigum <[email protected]> wrote:

> Puppet modules on Github are a good source. I've found a simple one:
>
> https://github.com/puppetlabs/puppetlabs-apache/blob/master/
> lib/facter/apache_version.rb
>
> And one of my own that's a little more complicated:
>
> https://github.com/LMAX-Exchange/puppet-networking-
> example/blob/master/lib/facter/interface_ringbuffer.rb
>
> -Luke
>
> On Thursday, 30 March 2017 13:10:35 UTC+1, Warron French wrote:
>>
>> Joshua, thanks for this feedback.  I don't really know ruby; can you
>> offer some ideas of where I can find other Puppet Facts written in Ruby
>> that don't look like my originally posted example?
>>
>> Thank you sir.
>>
>> --------------------------
>> Warron French
>>
>>
>> On Tue, Mar 28, 2017 at 10:51 AM, Joshua Schaeffer <[email protected]>
>> wrote:
>>
>>> External facts are a Puppet v4 feature only. You have to use Ruby to
>>> create custom facts in Puppet v3.
>>>
>>> On Monday, March 27, 2017 at 3:54:00 PM UTC-6, Warron French wrote:
>>>>
>>>> OK, done, and done.  But it still isn't showing up.
>>>>
>>>> Is this potentially because I am using PE-3.8 as a component of Red Hat
>>>> Satellite?
>>>>
>>>> --------------------------
>>>> Warron French
>>>>
>>>>
>>>> On Mon, Mar 27, 2017 at 5:28 PM, Peter Bukowinski <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi Warron,
>>>>>
>>>>> Puppet executes the script directly, so you need the shebang line and
>>>>> you must ensure the file is executable.
>>>>>
>>>>> -- Peter
>>>>>
>>>>> On Mar 27, 2017, at 2:25 PM, warron.french <[email protected]>
>>>>> wrote:
>>>>>
>>>>> Peter, perhaps I misunderstood you; but, I thought I was supposed to
>>>>> be able to use bash or sh scripting to generate facters of my own without
>>>>> the use of Ruby.
>>>>>
>>>>> The link you provided refers to a python script example.  It also adds
>>>>> a shebang line at the top of the script; do I need the shebang line, or
>>>>> will Puppet simply execute the shell script with:
>>>>>
>>>>> sh scriptname.sh
>>>>>
>>>>> Thanks for the feedback,
>>>>>
>>>>> --------------------------
>>>>> Warron French
>>>>>
>>>>>
>>>>> On Wed, Mar 22, 2017 at 7:07 PM, Peter Bukowinski <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Hi Warron,
>>>>>>
>>>>>> I'd consider using an external, executable fact to avoid ruby
>>>>>> altogether.
>>>>>>
>>>>>>   https://docs.puppet.com/facter/3.6/custom_facts.html#executa
>>>>>> ble-facts-----unix
>>>>>>
>>>>>> Basically, you can write a bash script (or use any language you want),
>>>>>> drop it into '<MODULEPATH>/<MODULE>/facts.d/' on your puppet server,
>>>>>> and it will be synced to all your nodes (assuming you use pluginsync).
>>>>>>
>>>>>> The only requirement for executable fact scripts is that they must
>>>>>> return key/value pairs in the format 'key=value'. Multiple keys/values
>>>>>> get their own line. In your case, you could do something like this:
>>>>>>
>>>>>> -----
>>>>>> #!/bin/bash
>>>>>>
>>>>>> key="qty_monitors_total"
>>>>>> value=$(your parsing command for /var/log/Xorg.0.log here)
>>>>>>
>>>>>> echo "${key}=${value}"
>>>>>> -----
>>>>>>
>>>>>> Save the file as an executable script in the above mentioned path and
>>>>>> it should be available on the next puppet run.
>>>>>>
>>>>>> On Wed, Mar 22, 2017 at 3:24 PM, warron.french <[email protected]>
>>>>>> wrote:
>>>>>> > Hello, I have finally learned how to write a Custom Fact; and
>>>>>> duplicated the
>>>>>> > syntax several times over inside the same .rb file.
>>>>>> >
>>>>>> > I am using syntax that looks like the following:
>>>>>> >
>>>>>> > Facter.add('qty_monitors_total') do
>>>>>> >       setcode  do
>>>>>> >              Facter::Util::Resolution.exec('/bin/grep " connected"
>>>>>> > /var/log/Xorg.0.log | cut -d\) -f2,3,4 | grep GPU |sort -u | wc -l')
>>>>>> >       end
>>>>>> > end
>>>>>> >
>>>>>> > I don't know of any other way to do this yet; but that's not my
>>>>>> concern yet.
>>>>>> >
>>>>>> > What I would like to know is how can I use an awk command within the
>>>>>> > Facter::Util::Resolution.exec('.........') line.
>>>>>> >
>>>>>> > I have a need to essentially reproduce the line above but drop   wc
>>>>>> -l and
>>>>>> > add awk '{ print $2"_"$3"_on_"$1$4 }'
>>>>>> >
>>>>>> > I need the awk command to pretty much look like this; the problem
>>>>>> is awk
>>>>>> > uses its own single quotes (') and it will break the ruby code.
>>>>>> >
>>>>>> > I am not a ruby developer; so if someone could either tell me:
>>>>>> >
>>>>>> > It's just not possible; or
>>>>>> > do it this way
>>>>>> >
>>>>>> >
>>>>>> > That would be greatly appreciated.  Thank you,
>>>>>> >
>>>>>> > --------------------------
>>>>>> > Warron French
>>>>>> >
>>>>>> > --
>>>>>> > 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/CAJdJdQmZXQAd
>>>>>> %2Bo%2Bnp-NHqxGHnXubf%2Bac-dP5FPoy4QYMEVuBuA%40mail.gmail.com.
>>>>>> > For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>> --
>>>>>> 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/CAJA1CN9aFH4E
>>>>>> za-FoxzrfXDWiGCUHXE%2BGFt2Nu%3DjK2eDzV4upg%40mail.gmail.com.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>> --
>>>>> 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/CAJdJdQnAbguK
>>>>> zz0S2O_NJfp2nzjeev77Ld7PHBEAOBH8_CZPsw%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/puppet-users/CAJdJdQnAbguKzz0S2O_NJfp2nzjeev77Ld7PHBEAOBH8_CZPsw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>> --
>>>>> 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/F53C3C7F-916F
>>>>> -4DB1-896F-8FF0F7F54BD6%40gmail.com
>>>>> <https://groups.google.com/d/msgid/puppet-users/F53C3C7F-916F-4DB1-896F-8FF0F7F54BD6%40gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> --
>>> 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/ms
>>> gid/puppet-users/73bd7507-03a3-4421-bf51-af2e9f37d62c%40googlegroups.com
>>> <https://groups.google.com/d/msgid/puppet-users/73bd7507-03a3-4421-bf51-af2e9f37d62c%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> 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/f28aa960-21c9-4d8f-a086-2e72d0893060%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/f28aa960-21c9-4d8f-a086-2e72d0893060%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAJdJdQkZAfd04t1P7dwewwXwhY0rZdekFdbOJDdO5vf_cT3ZUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to