On Mon, 26 Jul 2010, Douglas Garstang wrote:
  [need to compare two version numbers: "1.18.29-1" and "1.22"]
> 
> I can't do a pure mathematical comparison because the "-" is in the
> version number. I tried splitting that into two and passing the
> version as 1.18.29, but puppet complains about the ".".... you can't
> pass a float to a definition?

You can pass a string to a definition.  1.18.29 doesn't look like a float.

> This is version 0.24.8.... what options do I have?

You can use the versioncmp function.  It didn't quite work in puppet
0.24.8, but if you copy lib/puppet/parser/functions/versioncmp.rb from
puppet-0.25.0 then it should work.  See issue #2110.

I think you want somethng like this:

   if (versioncmp($version, "1.22") >= 0) {
     # do stuff
   }

--apb (Alan Barrett)

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to