Issue #2415 has been updated by Nigel Kersten.

It should return "0" if there is no minor version number, not nil.

10.6 *is* 10.6.0
----------------------------------------
Bug #2415: patch for first-rev Mac OS X versions
http://projects.reductivelabs.com/issues/2415

Author: eric sorenson
Status: Unreviewed
Priority: Normal
Assigned to: 
Category: library
Target version: 
Complexity: Trivial
Keywords: 


facter failed to run on my developer copy of snow leopard with the following 
error:

<pre>
[e...@leterel ...box/dotmac/puppet/etc_int2/modules]% /usr/local/bin/facter
/usr/local/lib/ruby/site_ruby/1.8/facter/util/macosx.rb:64:in `sw_vers': 
undefined method `last' for nil:NilClass (NoMethodError)
        from /usr/local/lib/ruby/site_ruby/1.8/facter/macosx.rb:46
        from /usr/local/lib/ruby/site_ruby/1.8/facter/util/loader.rb:72:in 
`load'
</pre>

this is because sw_vers -productVersion did not return a X.X.X like the regexp 
was looking for:

<pre>
[[email protected]/dotmac/puppet/etc_int2/modules]% sw_vers               
ProductName:    Mac OS X
ProductVersion: 10.6
BuildVersion:   10A402a
</pre>

The following patch fixes that and should work for all variants, by pulling the 
last dotted-decimal, no matter how deep (which I believe is desirable)

<pre>
>> "10.6.1".scan(/\.(\d+)/).last
=> ["1"]
>> "10.6".scan(/\.(\d+)/).last
=> ["6"]
>> "10.6.1.4.2".scan(/\.(\d+)/).last
=> ["2"]
</pre>

the trivial diff:

<pre>
64c64
<             ver["macosx_productversion_minor"] = 
productversion.scan(/(\d+)\.(\d+)\.(\d+)/)[0].last
---
>             ver["macosx_productversion_minor"] = 
> productversion.scan(/\.(\d+)/).last
</pre>


-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to