| Module | Facter::Util::Macosx |
| In: |
lib/facter/util/macosx.rb
|
macosx.rb Support methods for Apple OSX facts
Copyright (C) 2007 Jeff McCune Author: Jeff McCune <jeff.mccune@northstarlabs.net>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (version 2 of the License) This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston MA 02110-1301 USA
# File lib/facter/util/macosx.rb, line 48
48: def self.hardware_overview
49: profiler_data("SPHardwareDataType")
50: end
# File lib/facter/util/macosx.rb, line 31
31: def self.intern_xml(xml)
32: return nil unless xml
33: Plist::parse_xml(xml)
34: end
# File lib/facter/util/macosx.rb, line 52
52: def self.os_overview
53: profiler_data("SPSoftwareDataType")
54: end
Return an xml result, modified as we need it.
# File lib/facter/util/macosx.rb, line 37
37: def self.profiler_data(data_field)
38: begin
39: return nil unless parsed_xml = intern_xml(profiler_xml(data_field))
40: return nil unless data = parsed_xml[0]['_items'][0]
41: data.delete '_name'
42: data
43: rescue
44: return nil
45: end
46: end