diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-11 17:33:29 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-11 17:33:29 -0800 |
commit | 43cd21b687a8a46b59be410de8be5f0bf133d1dc (patch) | |
tree | 2886d2e8b3e7bf67b38e1bbad17c00db21e7129c /lib/ohai/plugins/darwin/system_profiler.rb | |
parent | 08c29c13309a4f7980dd4c3d5bc9eb29f0ec9ac8 (diff) | |
download | ohai-43cd21b687a8a46b59be410de8be5f0bf133d1dc.tar.gz |
chefstyle catchup for ohai
there's still a few cops that are unaddressed by this change, so it
won't be clean after merging this.
Diffstat (limited to 'lib/ohai/plugins/darwin/system_profiler.rb')
-rw-r--r-- | lib/ohai/plugins/darwin/system_profiler.rb | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/lib/ohai/plugins/darwin/system_profiler.rb b/lib/ohai/plugins/darwin/system_profiler.rb index 59f7e2ab..ad67320e 100644 --- a/lib/ohai/plugins/darwin/system_profiler.rb +++ b/lib/ohai/plugins/darwin/system_profiler.rb @@ -21,51 +21,50 @@ Ohai.plugin(:SystemProfile) do collect_data(:darwin) do begin - require 'plist' + require "plist" system_profile Array.new - items = Array.new + items = Array.new detail_level = { - 'mini' => [ - "SPParallelATAData", - "SPAudioData", - "SPBluetoothData", - "SPCardReaderData", - "SPDiagnosticsData", - "SPDiscBurningData", - "SPEthernetData", - "SPFibreChannelData", - "SPFireWireData", - "SPDisplaysData", - "SPHardwareRAIDData", - "SPMemoryData", - "SPModemData", - "SPNetworkData", - "SPPCIData", - "SPParallelSCSIData", - "SPPrintersSoftwareData", - "SPPrintersData", - "SPSASData", - "SPSerialATAData", - "SPSoftwareData", - "SPThunderboltData", - "SPUSBData", - "SPWWANData", - "SPAirPortData" - ], - 'full' => [ + "mini" => %w{ +SPParallelATAData +SPAudioData +SPBluetoothData +SPCardReaderData +SPDiagnosticsData +SPDiscBurningData +SPEthernetData +SPFibreChannelData +SPFireWireData +SPDisplaysData +SPHardwareRAIDData +SPMemoryData +SPModemData +SPNetworkData +SPPCIData +SPParallelSCSIData +SPPrintersSoftwareData +SPPrintersData +SPSASData +SPSerialATAData +SPSoftwareData +SPThunderboltData +SPUSBData +SPWWANData +SPAirPortData}, + "full" => [ "SPHardwareDataType" - ] + ], } detail_level.each do |level, data_types| so = shell_out("system_profiler -xml -detailLevel #{level} #{data_types.join(' ')}") - Plist::parse_xml(so.stdout).each do |e| + Plist.parse_xml(so.stdout).each do |e| items << e end end - system_profile items.sort_by { |h| h['_dataType'] } + system_profile items.sort_by { |h| h["_dataType"] } rescue LoadError => e Ohai::Log.debug("Can't load gem: #{e})") end |