Works great. Thanks.

Am Mittwoch, 25. November 2015 16:39:02 UTC+1 schrieb Peter Kristolaitis:
>
> Just realized my code is slightly wrong for you since you wanted hex 
> values rather than alphanumeric string.
>
> The first line should be:
>
> <% range = [*'0'..'9',*'a'..'f'] -%>
>
>
>
> On 11/25/2015 10:36 AM, Peter Kristolaitis wrote:
>
> <% 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, <javascript:>[email protected] <javascript:> 
> 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] <javascript:>.
> 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
> .
> 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] <javascript:>.
> To view this discussion on the web visit 
> <https://groups.google.com/d/msgid/puppet-users/5655D56A.3040803%40alter3d.ca?utm_medium=email&utm_source=footer>
> https://groups.google.com/d/msgid/puppet-users/5655D56A.3040803%40alter3d.ca
> .
> 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/4f4184dd-756f-476d-b03e-041d1a282e12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to