Hi Ken,

I did that as you said and on the client I get the file with:


$restricted myserv.ac.uk
$ideal_load 8 + 0.5
$max_load 8 * 1.2

where num_cpu = 8. But if put:

$i_load = $num_cpu + 0.5
$m_load = $num_cpu * 1.2

in the "init.pp" and then "$ideal_load <%= i_load %>" (same for the
$max_load) in the template file, it works.
Any idea what's wrong? Cheers!!

On Jun 15, 1:51 pm, Ken Barber <k...@puppetlabs.com> wrote:
> Your template file should look something like:
>
> $restricted <%= fqdn %>
> $ideal_load <%= num_cpu.to_i + 0.5 %>
> $max_load <%= num_cpu.to_i * 1.2 %>
>
> (the to_i is to ensure the conversion to integer - as I'm not sure
> what the input data looks like :-)
>
> Read the docs to get the full picture:
>
> http://docs.puppetlabs.com/guides/templating.html
>
> ken.
>
> On Wed, Jun 15, 2011 at 12:22 PM, Sans <r.santanu....@gmail.com> wrote:
> > I've added a custom fact, namely "num_cpu",  to Facter and
> > pluginsync'ing to distribute to the clients. Now I want to write a
> > template (as the num_cpu differs from client to client) file, which
> > will generate a file like this, in return:
>
> > $restricted myserv.ac.uk
> > $ideal_load 8.5
> > $max_load 9.6
>
> > for values for $ideal_load and $max_load are calculated like this:
> > "num_cpu + 0.5" and "num_cpu * 1.2" respectively. Can anyone give me
> > some idea how should I do that please? Cheers!!
>
> > --
> > 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+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to