Facter is basically a hash. You would want to name each specific 'fact'
with a unique name as it would have one value - hash is a key => value pair.
On Friday, October 10, 2014 10:57:02 AM UTC-7, Spriya wrote:
>
> Hi,
>
> require 'facter'
>
> ary = [1,2,3,4,5]
>
> ary.each do |numbers|
> Facter.add("base") do
> setcode do
> "#{numbers} "
> end
> end
> end
>
> In the fact it is returning only 1 value. In the fact it is returning base
> = 1 only not returning 2 3 4
>
> Help me
>
>
>
>
> On Friday, October 10, 2014 1:38:41 PM UTC-4, Craig White wrote:
>>
>> split is a string function
>>
>> your ary is an array as you defined it
>>
>> This will give you ruby functions for the Array class
>>
>> http://www.ruby-doc.org/core-2.1.3/Array.html
>>
>> Craig
>>
>> On Friday, October 10, 2014 7:39:05 AM UTC-7, Spriya wrote:
>>>
>>> Hi,
>>>
>>> when i am trying to do puppet custom facts to split [1,2,3,4,5] to
>>> 1
>>> 2
>>> 3
>>> 4
>>> 5
>>>
>>> *It is throwing me error:*
>>> *Error: Could not retrieve local facts: undefined method `split' for [1,
>>> 2, 3, 4, 5]:Array*
>>>
>>>
>>> *Here is my facts*
>>>
>>>
>>>
>>>
>>>
>>> *require 'facter'ary = [1,2,3,4,5]ary.map { |i| "'" + i.to_s +
>>> "'"}.join(",")#str = ""ary.each do |i|#id,val = row[i] val = ary.split
>>> ","Facter.add("base") do setcode do iendendendAnyone, help me*
>>>
>>
--
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/894bdfab-fa4c-4c42-aa22-8d487144b281%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.