Brent Clark
2013-May-15 07:15 UTC
[Puppet Users] Facter fact appears to be a string and not an array.
Good day I wrote my own fact for facter. And as you can see from my copy and paste it appears to be working. disk => ["/dev/sda", "/dev/sdb"] disk_count => 2 The problem I appear to have is. This is the code for my template. <%- @disk.each do |dev| %> disk <%= dev %> <%- end %> And the result I get back is/ + +disk /dev/sda/dev/sdb + as opposed to disk /dev/sda disk /dev/sdb Would anyone know why I am getting a string as opposed to an array. Another question, if you dont mind. Is there a reason why the interfaces fact is a string and not an array? interfaces => eth0,eth1,lo Kind Regards Brent Clark -- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
jcbollinger
2013-May-15 14:28 UTC
[Puppet Users] Re: Facter fact appears to be a string and not an array.
On Wednesday, May 15, 2013 2:15:14 AM UTC-5, Brent wrote:> > > Would anyone know why I am getting a string as opposed to an array. > >Because all facts are strings. That''s the way it has always been, though I understand there''s some work underway to provide for more data types in the future.> Another question, if you dont mind. Is there a reason why the interfaces > fact is a string and not an array? > interfaces => eth0,eth1,lo > >Yes, because all facts are strings. If you want an array then you can process the fact value through the split() function. John -- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.