[chef] Re: how to generate a random integer in a template.erb file


Chronological Thread 
  • From: Graham Christensen < >
  • To:
  • Subject: [chef] Re: how to generate a random integer in a template.erb file
  • Date: Wed, 13 Feb 2013 13:44:10 -0500

Hi David,


Note however, that if you generate the random number each time you try to write the template - it will rewrite the file each run. A more stable option would be storing this as a node attribute, and re-using it each time afterwards.

Graham Christensen

-- 
Graham Christensen

On Wednesday, February 13, 2013 at 1:41 PM, David Montgomery wrote:

Hi,

I am not a ruby expert but in a template I need to generate a random integer e.g. between 0 and 10000.

How would I do that?

thanks




Archive powered by MHonArc 2.6.16.

§