Re: [Puppet Users] Templates and loops..

2009-11-25 Thread br...@reductivelabs.com
On Mon, Nov 23, 2009 at 3:41 PM, Christopher Johnston wrote: > Yes it prints 4 directly into the file, but I cant put processorcount into > the loop. Works fine in ruby but erb fails. Any ideas here on how to do > this? I need to be able to determine the number of processors on the > systems so

Re: [Puppet Users] Templates and loops..

2009-11-25 Thread Ian Ward Comfort
On 23 Nov 2009, at 7:33 AM, Christopher Johnston wrote: > Its definitely there.. I even put a <%= processorcount %> to make > sure the variable is set. > > <% processorcount.to_i-1 %> > <% for cpu in (0..processorcount) %> Try: <% for cpu in (0 .. processorcount.to_i) %> -- Ian Ward C

Re: [Puppet Users] Templates and loops..

2009-11-25 Thread Ian Ward Comfort
On 23 Nov 2009, at 3:41 PM, Christopher Johnston wrote: > Yes it prints 4 directly into the file, but I cant put > processorcount into the loop. Works fine in ruby but erb fails. > Any ideas here on how to do this? I need to be able to determine > the number of processors on the systems so

Re: [Puppet Users] Templates and loops..

2009-11-25 Thread Christopher Johnston
Ignore me, I had a typo. I had put the parentheses around (0..(processorcount.to_i-1) but I forgot the closing ')' -Chris On Wed, Nov 25, 2009 at 11:30 AM, Peter Meier wrote: > > ah! I am still learning ruby here so appreciate the time spent to show > me > > this. > > > > Shouldn't this also

Re: [Puppet Users] Templates and loops..

2009-11-25 Thread Peter Meier
> ah! I am still learning ruby here so appreciate the time spent to show me > this. > > Shouldn't this also work to subtract (1) from the integer? Works in a ruby > script but not here. > > 19 <% processorcount.to_i - 1 %> > 20 <% for cpu in (0..processorcount.to_i) %> you mean it still counts u

Re: [Puppet Users] Templates and loops..

2009-11-25 Thread Christopher Johnston
ah! I am still learning ruby here so appreciate the time spent to show me this. Shouldn't this also work to subtract (1) from the integer? Works in a ruby script but not here. 19 <% processorcount.to_i - 1 %> 20 <% for cpu in (0..processorcount.to_i) %> On Mon, Nov 23, 2009 at 9:17 PM, Ohad

Re: [Puppet Users] Templates and loops..

2009-11-23 Thread Ohad Levy
your problems is that processorcount is a string, here are some examples that works: <% processorcount.each do |cpu| -%> <%= cpu.to_i * 100 %> <%# more stuff -%> <% end %> <% for cpu in (0..processorcount.to_i) %> <%= cpu %> <%end%> <% processorcount.to_i.times do |cpu| %> <%= cpu %> <%e

Re: [Puppet Users] Templates and loops..

2009-11-23 Thread Scott Smith
Christopher Johnston wrote: > Yes it prints 4 directly into the file, but I cant put processorcount > into the loop. Works fine in ruby but erb fails. Any ideas here on how > to do this? I need to be able to determine the number of processors on > the systems so I can generate a configuration

Re: [Puppet Users] Templates and loops..

2009-11-23 Thread Christopher Johnston
Yes it prints 4 directly into the file, but I cant put processorcount into the loop. Works fine in ruby but erb fails. Any ideas here on how to do this? I need to be able to determine the number of processors on the systems so I can generate a configuration file (loop through each processor numb

Re: [Puppet Users] Templates and loops..

2009-11-23 Thread Julian Simpson
2009/11/23 Christopher Johnston : > Its definitely there.. I even put a <%= processorcount %> to make sure the > variable is set. > <% processorcount.to_i-1 %> > <% for cpu in (0..processorcount) %> > Facter version is 1.52 > # facter  | grep proc > processor0 => Intel(R) Xeon(R) CPU           X557

Re: [Puppet Users] Templates and loops..

2009-11-23 Thread Christopher Johnston
Its definitely there.. I even put a <%= processorcount %> to make sure the variable is set. <% processorcount.to_i-1 %> <% for cpu in (0..processorcount) %> Facter version is 1.52 # facter | grep proc processor0 => Intel(R) Xeon(R) CPU X5570 @ 2.93GHz processor1 => Intel(R) Xeon(R) C

Re: [Puppet Users] Templates and loops..

2009-11-23 Thread Julian Simpson
2009/11/19 Christopher Johnston : > How come this doesnt work?  I write this in a normal ruby script it > works just fine. > > <% for cpu in (0..processorcount) %> > > I want to loop through the number of processor so a specific action > can be taken to generate content for a file. I get an error o