Hello;
Is it possible to include integer comparison in Puppet templates? An
example
node ''testy'' {
$foo = 5
if ( $foo > 4 ) {
include users::four
}
include files::motd
}
class files::motd {
file { "/etc/motd":
content => template("files/motd.conf.erb")
}
Template mord.conf.erb
<%if foo > 4 %> Have a foursy day <% end%>
In this eaxmple the users::four is included in the node. When it goes
to the motd.conf.erb file though it complains that I am trying to
compare a string to an integer.
Any way around this?
--
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.
Ben Hughes
2011-Mar-04 00:15 UTC
Re: [Puppet Users] Integer comparison in Puppet Templates
On Thu, Mar 03, 2011 at 01:26:19PM -0800, Michel wrote:> In this eaxmple the users::four is included in the node. When it > goes to the motd.conf.erb file though it complains that I am trying > to compare a string to an integer.Puppet internally presents that as a string. If you change it to: <%if foo.to_i > 4 %> Have a foursy day <% end%> That should work for you. -- Ben Hughes || http://www.puppetlabs.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.