<% range = [*'0'..'9',*'A'..'Z',*'a'..'z'] -%>
<hid><%= Array.new(7){range.sample}.join + "-" +
Array.new(3){range.sample}.join %></hid>
The "<% range ... -%>" can be anywhere in your template as long as it's
before where you generate the random value. I usually put stuff like
that near the top of the template. If you're generating multiple random
values you only need to specify it once.
On 11/25/2015 09:48 AM, [email protected] wrote:
I want to create a random hex string in the format
|
041f798-a5f
|
/
/inclusive the dash in a XML file.
I have tried using a self written shell script which generates the
string with
|
<hid><%=exec('/var/somedir/somescript')%></hid>
|
in the template. That unfortunately didn't work.
I suspect I have to write a small embedded ruby template / code
snipplet to generate this structure but after some web search I still
have no idea how to do that in Embedded Ruby. Does somebody have a
short erb suggestion?
--
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 [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/17c87311-bf8c-4aba-98ed-af30f62e3aca%40googlegroups.com
<https://groups.google.com/d/msgid/puppet-users/17c87311-bf8c-4aba-98ed-af30f62e3aca%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/5655D56A.3040803%40alter3d.ca.
For more options, visit https://groups.google.com/d/optout.