If I have... $version_core = "t.1538-1" $is_trunk_release = regsubst($version_core, ''^(.*?)\.(.*?)$'', ''\1'') if $is_trunk_release == "t" { notice ("here 1") if $t >= 1583 { notice ("here 2") } } Puppet complains with: comparison of String with 1583 failed at /etc/puppet/modules/elements/manifests/init.pp:220 on node app09.fr.xxx.com However, the documentation says you can do: if $ram > 1024 { $maxclient = 500 } So, therefore .... how can I convert $is_trunk_release to an integer so I can do a numerical comparison against it? Doug. -- 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.
On Tue, Sep 14, 2010 at 12:12 PM, Douglas Garstang <doug.garstang@gmail.com> wrote:> If I have... > > $version_core = "t.1538-1" > $is_trunk_release = regsubst($version_core, ''^(.*?)\.(.*?)$'', ''\1'') > if $is_trunk_release == "t" { > notice ("here 1") > if $t >= 1583 { > notice ("here 2") > } > } > > Puppet complains with: > comparison of String with 1583 failed at > /etc/puppet/modules/elements/manifests/init.pp:220 on node > app09.fr.xxx.com > > However, the documentation says you can do: > > if $ram > 1024 { > $maxclient = 500 > } > > So, therefore .... how can I convert $is_trunk_release to an integer > so I can do a numerical comparison against it? > > Doug. >Tried this: $is_trunk_release = regsubst($version_core, ''^(.*?)\.(.*?)$'', ''\1'') if $is_trunk_release == "t" { $trunk_release = regsubst($version_core, ''^(.*?)\.(.*?)$'', ''\2'') if (versioncmp($trunk_release, "1583") >= 0 { notice ("Trunk release > 1583") } } } This gives the same error. Doug. -- 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.
On Tue, Sep 14, 2010 at 12:12 PM, Douglas Garstang <doug.garstang@gmail.com> wrote:> If I have... > > $version_core = "t.1538-1" > $is_trunk_release = regsubst($version_core, ''^(.*?)\.(.*?)$'', ''\1'') > if $is_trunk_release == "t" { > notice ("here 1") > if $t >= 1583 { > notice ("here 2") > } > } > > Puppet complains with: > comparison of String with 1583 failed at > /etc/puppet/modules/elements/manifests/init.pp:220 on node > app09.fr.xxx.com > > However, the documentation says you can do: > > if $ram > 1024 { > $maxclient = 500 > }You can.> > So, therefore .... how can I convert $is_trunk_release to an integer > so I can do a numerical comparison against it?Where are you defining $t ? I don''t see it there. $version_core = "t.1538-1" $is_trunk_release = regsubst($version_core, ''^(.*?)\.(.*?)$'', ''\1'') if $is_trunk_release == "t" { notice ("here 1") notice("t is [$t]") # <------------------------- if $t >= 1583 { notice ("here 2") } } nigelk$ puppet --factpath /tmp/foo /tmp/test.pp notice: Scope(Class[main]): here 1 notice: Scope(Class[main]): t is [] comparison of String with 1583 failed at /tmp/test.pp:7 on node dhcp-172-19-29-14.mtv.corp.google.com -- 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.
On Tue, Sep 14, 2010 at 12:19 PM, Douglas Garstang <doug.garstang@gmail.com> wrote:> On Tue, Sep 14, 2010 at 12:12 PM, Douglas Garstang > <doug.garstang@gmail.com> wrote: >> If I have... >> >> $version_core = "t.1538-1" >> $is_trunk_release = regsubst($version_core, ''^(.*?)\.(.*?)$'', ''\1'') >> if $is_trunk_release == "t" { >> notice ("here 1") >> if $t >= 1583 { >> notice ("here 2") >> } >> } >> >> Puppet complains with: >> comparison of String with 1583 failed at >> /etc/puppet/modules/elements/manifests/init.pp:220 on node >> app09.fr.xxx.com >> >> However, the documentation says you can do: >> >> if $ram > 1024 { >> $maxclient = 500 >> } >> >> So, therefore .... how can I convert $is_trunk_release to an integer >> so I can do a numerical comparison against it? >> >> Doug. >> > > Tried this: > > $is_trunk_release = regsubst($version_core, ''^(.*?)\.(.*?)$'', ''\1'') > if $is_trunk_release == "t" { > $trunk_release = regsubst($version_core, ''^(.*?)\.(.*?)$'', ''\2'') > if (versioncmp($trunk_release, "1583") >= 0 { > notice ("Trunk release > 1583") > } > } > } > > This gives the same error.That doesn''t even parse for me.> > Doug. > > -- > 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. > >-- nigel -- 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.