On Thu, Feb 12, 2009 at 12:58 AM, Paul Nasrat <pnas...@googlemail.com> wrote:
>
>> We refactored the directoryservice provider in puppet 0.24.7 to use the 
>> -plist option so that
>> output could be parsed more easily to resolve a bug with values with spaces 
>> in the name.
>> We missed that 10.4 does not support this flag, so this patch adds -url 
>> output support back in
>> for OS X 10.4 clients only as well as a new -url output parser that copes 
>> with spaces. 10.5
>> clients continue to use the -plist method.
>
>> Also includes some miscellaneous cleanup of methods and removal of 
>> extraneous comments.
>> +    def self.get_macosx_version_major
>> +        if defined? @macosx_version_major
>> +            return @macosx_version_major
>> +        end
>> +        begin
>> +            product_version_major = 
>> sw_vers("-productVersion").scan(/(\d+)\.(\d+)./).join(".")
>> +            if %w{10.0 10.1 10.2 10.3}.include?(product_version_major)
>> +                raise Puppet::Error, "%s is not supported by the 
>> directoryservice provider" % product_version_major
>> +            end
>> +            @macosx_version_major = product_version_major
>> +            return @macosx_version_major
>> +        rescue Puppet::ExecutionFailure => detail
>> +            raise Puppet::Error, "Could not get determine OS X version: %s" 
>> % detail
>>         end
>>     end
>
> We already have a fact for macosx_productversion that you could split
> on, to get major version (as an aside we could also provide that if
> it's going to be generally useful) any particular reason you're
> re-execing here rather than using the fact?

Using the fact value has been completely unreliable. I'll be bug
reporting it once I've worked out the shape of the problem better.

$ irb
>> require 'facter'
=> true
>> Facter.value("operatingsystem")
=> "Darwin"
>> Facter.value("macosx_productversion")
=> nil

$ facter | grep productversion
macosx_productversion => 10.5.6



-- 
Nigel Kersten
Systems Administrator
Tech Lead - MacOps

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

Reply via email to