FAQ
HI everyone,




I am trying to use the ruby modulo function but without any success, here
is the template:
--
$tt=regsubst($::hostname,'.*front(\d+).*','\1')
notice("$tt")
notice(inline_template("<% tt.to_i.modulo(60) %>"))
--
Here is the result:
notice: Scope(Class[main]): 04
notice: Scope(Class[main]):
notice: Finished catalog run in 0.22 seconds


Any idea?



Regards,
JM

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Hendrik Jäger at Jun 20, 2012 at 9:25 am
    Hi,

    - notice(inline_template("<% tt.to_i.modulo(60) %>"))
    + notice(inline_template("<%= tt.to_i.modulo(60) %>"))

    Best regards

    henk
  • Antidot SAS at Jun 20, 2012 at 10:23 am
    Thx, it helps :D

    On Wed, Jun 20, 2012 at 11:24 AM, Hendrik Jäger wrote:

    Hi,

    - notice(inline_template("<% tt.to_i.modulo(60) %>"))
    + notice(inline_template("<%= tt.to_i.modulo(60) %>"))

    Best regards

    henk
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Ilya Dmitrichenko at Jun 24, 2012 at 6:25 pm

    On Jun 20, 2012 10:06 AM, "Antidot SAS" wrote:
    HI everyone,




    I am trying to use the ruby modulo function but without any success, here
    is the template:
    --
    $tt=regsubst($::hostname,'.*front(\d+).*','\1')
    notice("$tt")
    notice(inline_template("<% tt.to_i.modulo(60) %>"))
    try `"<%= tt.to_i.modulo(60).to_s %>"`, well `to_s` is just for being
    explicit really and you can omit it, but what's important is the `<%=`
    instead of `%<`. See a Ruby template tutorial for more details :)
    --
    Here is the result:
    notice: Scope(Class[main]): 04
    notice: Scope(Class[main]):
    notice: Finished catalog run in 0.22 seconds


    Any idea?



    Regards,
    JM

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://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+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedJun 20, '12 at 9:06a
activeJun 24, '12 at 6:25p
posts4
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase