Issue #1807 has been updated by masterzen. Category set to plumbing Status changed from Accepted to Ready for Checkin Assigned to changed from masterzen to jamtur01 % Done changed from 0 to 100
luke wrote: > This should be easy; I'll get to it unless someone beats me to it... Fixed in tickets/0.24.x/1807: http://github.com/masterzen/puppet/tree/tickets/0.24.x/1807 ---------------------------------------- Feature #1807: make versioncmp a module function http://projects.reductivelabs.com/issues/show/1807 Author: micah Status: Ready for Checkin Priority: Normal Assigned to: jamtur01 Category: plumbing Target version: Complexity: Trivial Affected version: 0.24.6 Keywords: Puppet::Util::Package has versioncmp, which is a very useful function, there is also the fact puppetversion. However, even though these are both available, they aren't easily used in a template, if versioncmp was a module function then it would be, but until then I had to do the following to test for the correct version of puppet installed, which requires different methods for doing the same thing: <pre> <%- include Puppet::Util::Package class VersionComparer; extend Puppet::Util::Package; end if VersionComparer.versioncmp(Puppet.version,'0.24.6') >= 0 %w{type host directory user sshoptions}.each do |v| if has_variable?(v) -%> <%= v + ' = ' + instance_variable_get("@#{v}").to_s %> <%- end end %> <%- else -%> <%- %w{type host directory user sshoptions}.each do |v| if @scope.lookupvar(v) -%> <%= v + ' = ' + @scope.lookupvar(v) %> <%- end end %> <%- end -%> </pre> ... a bit ugly, but it works (thanks to lak for his patience with this). ---------------------------------------- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://reductivelabs.com/redmine/my/account --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en -~----------~----~----~----~------~----~------~--~---
