Issue #1807 has been reported by micah.
----------------------------------------
Feature #1807: make versioncmp a module function
http://projects.reductivelabs.com/issues/show/1807
Author: micah
Status: Unreviewed
Priority: Normal
Assigned to:
Category:
Target version:
Complexity: Unknown
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
-~----------~----~----~----~------~----~------~--~---