Hi there, i can''t use array in puppet. Here is my codesnipplet: $callapidata = [ ''wert1'',''wert2''] notice $callapidata[1] A puppetrun results in: Could not retrieve catalog from remote server: Error 400 on SERVER: can''t convert String into Integer at /etc/puppet/myenv/modules/ uc4client/manifests/init.pp:41 on node testnode Thanks for your help. Greetings Roband -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Talking a bit through my hat here.. but: On 11-06-16 05:36 AM, Roband wrote:> i can''t use array in puppet. Here is my codesnipplet: > > $callapidata = [ ''wert1'',''wert2''] > notice $callapidata[1]try something like the following instead of the second line: notice { $callapidata[1]: } -- Gabriel Filion -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
What version of puppet are you using? kbarber:~ ken$ puppet --version 2.6.8 kbarber:~ ken$ puppet -e ''$callapidata = [ ''wert1'',''wert2''] notice $callapidata[1]'' notice: Scope(Class[main]): wert2 notice: Finished catalog run in 0.01 seconds kbarber:~ ken$ ken. On Thu, Jun 16, 2011 at 10:36 AM, Roband <andreas.hacker@universa.de> wrote:> Hi there, > > i can''t use array in puppet. Here is my codesnipplet: > > $callapidata = [ ''wert1'',''wert2''] > notice $callapidata[1] > > A puppetrun results in: > > Could not retrieve catalog from remote server: Error 400 on SERVER: > can''t convert String into Integer at /etc/puppet/myenv/modules/ > uc4client/manifests/init.pp:41 on node testnode > > > Thanks for your help. > > > Greetings > Roband > > -- > 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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hi, I tried notice { $callapidata[1]: } => Same Error: Could not retrieve catalog from remote server: Error 400 on SERVER: can''t convert String into Integer at /etc/puppet/myenv/modules/uc4client/manifests/init.pp:41 on node testnode I use version 2.6.1 -- 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/-/4ZKy4HH1KvwJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
http://projects.puppetlabs.com/issues/5127 Addressing array by index is not possible with Version 2.6.1 Unfortunately we can''t update our puppet :-( Tahnk you all for your help. -- 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/-/bA52_IB2vXUJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
same problem here: puppet version is 2.6.1. That''s the most recent version available in Ubuntu Maverick (10.10). Any chance, that a more recent version will be available in ubuntu maverick? greetings -- 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/-/Jw4JImkOn2kJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
I know it''s a ugly hack, but this saved me: $myarray = [''1'', ''2'', ''3''] $var0 = inline_template("<%=myarray.split('','')[0]%>") $var1 = inline_template("<%=myarray.split('','')[1]%>") -- Bob -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Mon, Jul 18, 2011 at 8:11 PM, Bob <voje2000@gmail.com> wrote:> I know it''s a ugly hack, but this saved me: > > $myarray = [''1'', ''2'', ''3''] > > $var0 = inline_template("<%=myarray.split('','')[0]%>") > $var1 = inline_template("<%=myarray.split('','')[1]%>")Should this be: $var0 = inline_template("<%=myarray[0]%>") If this type of feature is needed it can be provided via puppet function. The examples here https://github.com/puppetlabs/puppetlabs-functions can provide a jump start for converting any quick hacks via inline_template to something that''s much more maintainable. Thanks, Nan -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.