Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'OHAI-357'

  • Loading branch information...
commit 8995352f35f117013b02bfe00ca66a4ad54315f1 2 parents eb470aa + 95076c5
@btm btm authored
View
0  1
No changes.
View
1  lib/ohai/plugins/kernel.rb
@@ -24,6 +24,7 @@
case languages[:ruby][:host_os]
when /mswin|mingw32|windows/
require_plugin "windows::kernel"
+ require_plugin "windows::kernel_devices"
else
kernel[:name] = from("uname -s")
kernel[:release] = from("uname -r")
View
19 lib/ohai/plugins/windows/kernel.rb
@@ -56,22 +56,3 @@ def os_lookup(sys_type)
end
kernel[:machine] = machine_lookup("#{kernel[:cs_info][:system_type]}")
-
-kext = Mash.new
-pnp_drivers = Mash.new
-
-drivers = WMI::Win32_PnPSignedDriver.find(:all)
-drivers.each do |driver|
- pnp_drivers[driver.DeviceID] = Mash.new
- driver.properties_.each do |p|
- pnp_drivers[driver.DeviceID][p.name.wmi_underscore.to_sym] = driver.send(p.name)
- end
- if driver.DeviceName
- kext[driver.DeviceName] = pnp_drivers[driver.DeviceID]
- kext[driver.DeviceName][:version] = pnp_drivers[driver.DeviceID][:driver_version]
- kext[driver.DeviceName][:date] = pnp_drivers[driver.DeviceID][:driver_date] ? pnp_drivers[driver.DeviceID][:driver_date].to_s[0..7] : nil
- end
-end
-
-kernel[:pnp_drivers] = pnp_drivers
-kernel[:modules] = kext
View
39 lib/ohai/plugins/windows/kernel_devices.rb
@@ -0,0 +1,39 @@
+#
+# Author:: James Gartrell (<jgartrel@gmail.com>)
+# Copyright:: Copyright (c) 2009 Opscode, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+require 'ruby-wmi'
+
+WIN32OLE.codepage = WIN32OLE::CP_UTF8
+
+kext = Mash.new
+pnp_drivers = Mash.new
+
+drivers = WMI::Win32_PnPSignedDriver.find(:all)
+drivers.each do |driver|
+ pnp_drivers[driver.DeviceID] = Mash.new
+ driver.properties_.each do |p|
+ pnp_drivers[driver.DeviceID][p.name.wmi_underscore.to_sym] = driver.send(p.name)
+ end
+ if driver.DeviceName
+ kext[driver.DeviceName] = pnp_drivers[driver.DeviceID]
+ kext[driver.DeviceName][:version] = pnp_drivers[driver.DeviceID][:driver_version]
+ kext[driver.DeviceName][:date] = pnp_drivers[driver.DeviceID][:driver_date] ? pnp_drivers[driver.DeviceID][:driver_date].to_s[0..7] : nil
+ end
+end
+
+kernel[:pnp_drivers] = pnp_drivers
+kernel[:modules] = kext

0 comments on commit 8995352

Please sign in to comment.
Something went wrong with that request. Please try again.