Hello, If I want to do something like this:- if $::lsbdistrelease >= 6.3 { SOMETHING } Do I have to convert lsbdistrelease from a string to a number with an inline template or some such ? Thanks Paul -- 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 puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Il 18/03/2013 17:16, OlliesDad@googlemail.com ha scritto:> Hello, > > If I want to do something like this:- > > if $::lsbdistrelease >= 6.3 { > SOMETHING > } > > Do I have to convert lsbdistrelease from a string to a number with an > inline template or some such ?Hi, you can use versioncmp(), it''s a builtin function http://docs.puppetlabs.com/references/latest/function.html#versioncmp ciao, -- Alessandro Ogier Specialista Reti e Sistemi - Area Ricerca Direzione ICT Gruppo IEO/CCM Istituto Europeo di Oncologia Via Serio, 15 - 20139 Milan, Italy P +39 02 94375269 E alessandro.ogier@ieo.eu W http://www.ieo.it -- 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 puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
thanks ,that''s help me, too! On Tue, Mar 19, 2013 at 12:25 AM, Alessandro Ogier <alessandro.ogier@ieo.eu>wrote:> Il 18/03/2013 17:16, OlliesDad@googlemail.com ha scritto: > > Hello, >> >> If I want to do something like this:- >> >> if $::lsbdistrelease >= 6.3 { >> SOMETHING >> } >> >> Do I have to convert lsbdistrelease from a string to a number with an >> inline template or some such ? >> > > Hi, you can use versioncmp(), it''s a builtin function > > http://docs.puppetlabs.com/**references/latest/function.**html#versioncmp<http://docs.puppetlabs.com/references/latest/function.html#versioncmp> > > > > ciao, > -- > Alessandro Ogier > Specialista Reti e Sistemi - Area Ricerca > Direzione ICT Gruppo IEO/CCM > > Istituto Europeo di Oncologia > Via Serio, 15 - 20139 Milan, Italy > P +39 02 94375269 > E alessandro.ogier@ieo.eu > W http://www.ieo.it > > > -- > 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 puppet-users+unsubscribe@**googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > . > To post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/**group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en> > . > For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> > . > > >-- 尹川 成都世纪东方网络通信有限公司 手机:18628014224 QQ:254113859 -- 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 puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Monday, March 18, 2013 11:16:41 AM UTC-5, Olli...@googlemail.com wrote:> > Hello, > > If I want to do something like this:- > > if $::lsbdistrelease >= 6.3 { > SOMETHING > } > > Do I have to convert lsbdistrelease from a string to a number with an > inline template or some such ? > >Generally speaking, yes. All fact values are strings, and the language docs specify that the behavior of the <, <=, >=, and > operators is undefined for strings. For this particular case, however, Alessandro Ogier''s suggestion to use the versioncmp() function is an excellent one. Not only is it easy to use, but it still does what you (probably) want when you compare against, say, version 6.11. John -- 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 puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.