Skip to content

Commit

Permalink
Merge pull request #1468 from chef/blocklist
Browse files Browse the repository at this point in the history
Remove an internal reference to blacklist
  • Loading branch information
tas50 authored Jun 17, 2020
2 parents c01c03f + 09946ce commit 9174496
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ end
group :debug do
gem "pry"
gem "pry-byebug"
gem "pry-stack_explorer"
gem "pry-stack_explorer", "~> 0.4.0" # pin until we drop ruby < 2.6
gem "rb-readline"
end
15 changes: 8 additions & 7 deletions lib/ohai/plugins/kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Author:: Bryan McLellan (<[email protected]>)
# Author:: Claire McQuin (<[email protected]>)
# Author:: James Gartrell (<[email protected]>)
# Copyright:: Copyright (c) 2008-2018 Chef Software, Inc.
# Copyright:: Copyright (c) Chef Software, Inc.
# Copyright:: Copyright (c) 2009 Bryan McLellan
# License:: Apache License, Version 2.0
#
Expand Down Expand Up @@ -137,11 +137,12 @@ def pc_system_type_decode(type)
end
end

# see if a WMI name is blacklisted so we can avoid writing out
# useless data to ohai
# see if a WMI name is in the blocked list so we can avoid writing
# out useless data to ohai
#
# @param [String] name the wmi name to check
# @return [Boolean] is the wmi name blacklisted
def blacklisted_wmi_name?(name)
# @return [Boolean] is the wmi name in the blocked list
def blocked_wmi_name?(name)
[
"creation_class_name", # this is just the wmi name
"cs_creation_class_name", # this is just the wmi name
Expand Down Expand Up @@ -262,7 +263,7 @@ def blacklisted_wmi_name?(name)
host = wmi.first_of("Win32_OperatingSystem")
kernel[:os_info] = Mash.new
host.wmi_ole_object.properties_.each do |p|
next if blacklisted_wmi_name?(p.name.wmi_underscore)
next if blocked_wmi_name?(p.name.wmi_underscore)

kernel[:os_info][p.name.wmi_underscore.to_sym] = host[p.name.downcase]
end
Expand All @@ -277,7 +278,7 @@ def blacklisted_wmi_name?(name)
kernel[:cs_info] = Mash.new
host = wmi.first_of("Win32_ComputerSystem")
host.wmi_ole_object.properties_.each do |p|
next if blacklisted_wmi_name?(p.name.wmi_underscore)
next if blocked_wmi_name?(p.name.wmi_underscore)

kernel[:cs_info][p.name.wmi_underscore.to_sym] = host[p.name.downcase]
end
Expand Down

0 comments on commit 9174496

Please sign in to comment.