Actually Facter does support arrays since v2.0.1, Ritesh did not mention 
which version he was using.

Ritesh if you use Facter 2.0.1 I recommend you to make sure your fact is an 
actual Structured Fact, like described in this documentation page: Facter 
2.0: Overview of Custom Facts With 
Examples<http://docs.puppetlabs.com/facter/2.0/fact_overview.html#writing-structured-facts>
I suspect you're trying to build an array from Strings using a funny 
construction, like concatenate "[" and "]" to your data, am I right? This 
is indeed how you define it in Puppet DSL, but in Ruby (and Facter) this 
would still be recognized as a string.


On Tuesday, April 22, 2014 9:47:20 PM UTC+2, Jose Luis Ledesma wrote:
>
> Facter doesn't support arrays, only strings until v2.0, so the only way I 
> know if what you did, although I usually use this form:
>
> Anyfact => value1,value2,value3
>
> And then just split with the ,
>
> Regards,
> El 22/04/2014 20:10, "Ritesh Nanda" <ritesh...@gmail.com <javascript:>> 
> escribió:
>
>> Hello Toni , John
>>
>> Thanks for your help.
>>
>> Doing validate array gives a  
>>
>>  Error 400 on SERVER: "" is not an Array.  It looks to be a String
>>
>> I made it working using  $arrayvar = split($::arraydev, '[,]') then 
>> calling  test::exeecho{$arrayvar:} , in this way it works and its process 
>> the array . 
>>
>> now the init.pp looks like 
>>
>> class test {
>> $arrayvar = split($::arraydev, '[,]')
>> test::exeecho{$arrayvar:}
>> }
>>
>> Doing validate array tells me it is string not an array , Is this the 
>> right way to do it. Or there can be a better way to do it.
>>
>> Regards,
>> Ritesh Nanda
>>
>>
>> On Monday, 21 April 2014 17:27:21 UTC-6, Ritesh Nanda wrote:
>>>
>>> Hello , 
>>>
>>> I have a custom facts which returns the block devices based on some 
>>> condition in an array.
>>>
>>>  facter | grep arraydev
>>> arraydev => ["sdb", "sdc"]
>>>
>>> Now i want to use this array in defined type so that a exec resource can 
>>> run as no. of times elements in the array.
>>>
>>> vi modules/test/manifest/exeecho.pp
>>>
>>> define test::exeecho() {
>>>         exec {"echo_${name}":
>>>           command => "echo hello >> /tmp/foo23",
>>>           path => ['/bin'],
>>>          }
>>>        }
>>>
>>>
>>> vi modules/test/manifest/init.pp
>>>
>>> class test {
>>> test::exeecho{$::arraydev:}
>>> }
>>>
>>>
>>> But puppet agent -t run gives a error.
>>>
>>> Error: Could not retrieve catalog from remote server: Error 400 on 
>>> SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: 
>>> Invalid resource type exec at /etc/puppetlabs/puppet/
>>> modules/test/manifests/exeecho.pp:5 on node pzxdcc0002.cdbt.pldc.kp.org
>>> Warning: Not using cache on failed catalog
>>> Error: Could not retrieve catalog; skipping run
>>>
>>> Please tell me if i am doing something wrong.
>>>
>>> Regards,
>>> Ritesh Nanda
>>>
>>>
>>>
>>>
>>>
>>>
>>>  -- 
>> 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...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/puppet-users/5f7536a9-a42e-4f1d-b1fe-1b4bda324f51%40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/5f7536a9-a42e-4f1d-b1fe-1b4bda324f51%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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/d858d064-bceb-421d-8db3-9bf75bf4f186%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to