ohai 16.2.3 → 16.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: caa70e908138b3a05e5936f250179ad6eb43720978cc1c4296011df3d9da7478
4
- data.tar.gz: 91020ca991c49f7e029604403bf4421be6f608fc5330bf787eae09b3dd6cb844
3
+ metadata.gz: b791ee540d095a6bbdca2f681a5b2dbbe8574f2b58e5ba9c274fdaccc210c86f
4
+ data.tar.gz: db0fc191334ce76a8c0effc4a66afd1c9f025125e10186feb0f3ebf03dbb1768
5
5
  SHA512:
6
- metadata.gz: e4204d5dadf0987967638c08e61124c5226810a07c83b200a4b7713c4736ce97f9bf229210fa19c06ab09d8aa4363b0389192598710d75d1b92ab055c473401d
7
- data.tar.gz: 3f1620eb9f6fc44f2fc3f81e974be7d69762d7a783a010b30b415fd6365db4584daa57e42d985055551aeac94bf540986f6a6e5419b22a2ea4118fc1a0a0b03b
6
+ metadata.gz: 9b5f2dfbe7e517ef9f0bb6fa334bb66e8b6623356fabe0211aa895e416a50fbb6b97d39cfc422cc7727d2d943aa3aa8ff4e3f5fe71877f702212b55a83484115
7
+ data.tar.gz: d1a23eb7a0cc5aa5619edb4568ae2e4f0e930d4356ecea2356a789c8c37b49ea0660d9c39b11bddb577f78871dc0c383e2af2bb03c8eac6120fe680e89797622
@@ -65,7 +65,7 @@ module Ohai
65
65
  #
66
66
  # @return [String]
67
67
  def self.dev_null
68
- if RUBY_PLATFORM =~ /mswin|mingw|windows/
68
+ if RUBY_PLATFORM.match?(/mswin|mingw|windows/)
69
69
  "NUL"
70
70
  else
71
71
  "/dev/null"
@@ -30,7 +30,7 @@ module Ohai
30
30
  options = options.dup
31
31
  # unless specified by the caller timeout after configured timeout (default 30 seconds)
32
32
  options[:timeout] ||= Ohai::Config.ohai[:shellout_timeout]
33
- unless RUBY_PLATFORM =~ /mswin|mingw32|windows/
33
+ unless RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
34
34
  options[:env] = options.key?(:env) ? options[:env].dup : {}
35
35
  options[:env]["PATH"] ||= ((ENV["PATH"] || "").split(":") + %w{/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin}).join(":")
36
36
  end
@@ -26,7 +26,7 @@ module ::Ohai::Mixin::DmiDecode
26
26
  when /VMware/
27
27
  return "vmware"
28
28
  when /Microsoft/
29
- return "hyperv" if product =~ /Virtual Machine/
29
+ return "hyperv" if /Virtual Machine/.match?(product)
30
30
  when /Amazon EC2/
31
31
  return "amazonec2"
32
32
  when /QEMU/
@@ -57,7 +57,7 @@ Ohai.plugin(:Virtualization) do
57
57
  sections.each do |line|
58
58
  case title
59
59
  when "network"
60
- next if line =~ /^Interface|^---/
60
+ next if /^Interface|^---/.match?(line)
61
61
 
62
62
  splat = line.strip.split
63
63
  key = splat[0].downcase
@@ -68,7 +68,7 @@ Ohai.plugin(:Virtualization) do
68
68
  }
69
69
  wpars[wpar_name][title][key] = value
70
70
  when "user-specified routes"
71
- next if line =~ /^Type|^---/
71
+ next if /^Type|^---/.match?(line)
72
72
 
73
73
  splat = line.strip.split
74
74
  key = splat[2].downcase
@@ -78,7 +78,7 @@ Ohai.plugin(:Virtualization) do
78
78
  }
79
79
  wpars[wpar_name][title][key] = value
80
80
  when "file systems"
81
- next if line =~ /^MountPoint|^---/
81
+ next if /^MountPoint|^---/.match?(line)
82
82
 
83
83
  splat = line.strip.split
84
84
  key = splat[1].downcase
@@ -93,7 +93,7 @@ Ohai.plugin(:Virtualization) do
93
93
  privileges ||= ""
94
94
  wpars[wpar_name][title]["Privileges"] ||= []
95
95
 
96
- if line =~ /^Privileges/
96
+ if /^Privileges/.match?(line)
97
97
  privileges << line.split(":")[1].strip
98
98
  else
99
99
  privileges << line.strip
@@ -101,7 +101,7 @@ Ohai.plugin(:Virtualization) do
101
101
 
102
102
  wpars[wpar_name][title]["Privileges"] += privileges.split(",")
103
103
  when "device exports"
104
- next if line =~ /^Name|^---/
104
+ next if /^Name|^---/.match?(line)
105
105
 
106
106
  splat = line.strip.split
107
107
  key = splat[0].downcase
@@ -57,7 +57,7 @@ Ohai.plugin(:Azure) do
57
57
  has_245 = false
58
58
  if File.exist?("/var/lib/dhcp/dhclient.eth0.leases")
59
59
  File.open("/var/lib/dhcp/dhclient.eth0.leases").each do |line|
60
- if line =~ /unknown-245/
60
+ if /unknown-245/.match?(line)
61
61
  logger.trace("Plugin Azure: Found unknown-245 DHCP option used by Azure.")
62
62
  has_245 = true
63
63
  break
@@ -76,7 +76,7 @@ Ohai.plugin(:Virtualization) do
76
76
  # Detect KVM/QEMU paravirt guests from cpu, report as KVM
77
77
  # hw.model: QEMU Virtual CPU version 0.9.1
78
78
  so = shell_out("sysctl -n hw.model")
79
- if so.stdout =~ /QEMU Virtual CPU|KVM processor/
79
+ if /QEMU Virtual CPU|KVM processor/.match?(so.stdout)
80
80
  virtualization[:system] = "kvm"
81
81
  virtualization[:role] = "guest"
82
82
  virtualization[:systems][:kvm] = "guest"
@@ -96,7 +96,7 @@ Ohai.plugin(:Virtualization) do
96
96
  "xen"
97
97
  when /kvm/
98
98
  so = shell_out("sysctl -n kern.hostuuid")
99
- so.stdout =~ /^ec2/ ? "amazonec2" : "kvm"
99
+ /^ec2/.match?(so.stdout) ? "amazonec2" : "kvm"
100
100
  when /bhyve/
101
101
  "bhyve"
102
102
  end
@@ -305,7 +305,7 @@ Ohai.plugin(:CPU) do
305
305
  cpu[index] = Mash.new
306
306
  cpu[index][:status] = status
307
307
  cpu[index][:location] = location
308
- if status =~ /Available/
308
+ if /Available/.match?(status)
309
309
  cpu[:available] += 1
310
310
  lsattr = shell_out("lsattr -El #{name}").stdout.lines
311
311
  lsattr.each do |attribute|
@@ -66,8 +66,8 @@ Ohai.plugin(:Network) do
66
66
 
67
67
  def scope_lookup(scope)
68
68
  return "Node" if scope.eql?("::1")
69
- return "Link" if scope =~ /^fe80\:/
70
- return "Site" if scope =~ /^fec0\:/
69
+ return "Link" if /^fe80\:/.match?(scope)
70
+ return "Site" if /^fec0\:/.match?(scope)
71
71
 
72
72
  "Global"
73
73
  end
@@ -79,7 +79,7 @@ Ohai.plugin(:Network) do
79
79
  def locate_interface(ifaces, ifname, mac)
80
80
  return ifname unless ifaces[ifname].nil?
81
81
  # oh well, time to go hunting!
82
- return ifname.chop if ifname =~ /\*$/
82
+ return ifname.chop if /\*$/.match?(ifname)
83
83
 
84
84
  ifaces.each_key do |ifc|
85
85
  ifaces[ifc][:addresses].each_key do |addr|
@@ -82,7 +82,7 @@ Ohai.plugin(:Virtualization) do
82
82
  virtualization[:systems][:parallels] = "host"
83
83
  elsif ioreg_exists?
84
84
  so = shell_out("ioreg -l")
85
- if so.stdout =~ /pci1ab8,4000/
85
+ if /pci1ab8,4000/.match?(so.stdout)
86
86
  virtualization[:system] = "parallels"
87
87
  virtualization[:role] = "guest"
88
88
  virtualization[:systems][:parallels] = "guest"
@@ -41,7 +41,7 @@ Ohai.plugin(:EC2) do
41
41
  # @return [Boolean] do we have Amazon DMI data?
42
42
  def has_ec2_amazon_dmi?
43
43
  # detect a version of '4.2.amazon'
44
- if file_val_if_exists("/sys/class/dmi/id/bios_vendor") =~ /Amazon/
44
+ if /Amazon/.match?(file_val_if_exists("/sys/class/dmi/id/bios_vendor"))
45
45
  logger.trace("Plugin EC2: has_ec2_amazon_dmi? == true")
46
46
  true
47
47
  else
@@ -56,7 +56,7 @@ Ohai.plugin(:EC2) do
56
56
  # @return [Boolean] do we have Amazon DMI data?
57
57
  def has_ec2_xen_dmi?
58
58
  # detect a version of '4.2.amazon'
59
- if file_val_if_exists("/sys/class/dmi/id/bios_version") =~ /amazon/
59
+ if /amazon/.match?(file_val_if_exists("/sys/class/dmi/id/bios_version"))
60
60
  logger.trace("Plugin EC2: has_ec2_xen_dmi? == true")
61
61
  true
62
62
  else
@@ -68,7 +68,7 @@ Ohai.plugin(:EC2) do
68
68
  # looks for a xen UUID that starts with ec2 from within the Linux sys tree
69
69
  # @return [Boolean] do we have a Xen UUID or not?
70
70
  def has_ec2_xen_uuid?
71
- if file_val_if_exists("/sys/hypervisor/uuid") =~ /^ec2/
71
+ if /^ec2/.match?(file_val_if_exists("/sys/hypervisor/uuid"))
72
72
  logger.trace("Plugin EC2: has_ec2_xen_uuid? == true")
73
73
  return true
74
74
  end
@@ -81,10 +81,10 @@ Ohai.plugin(:EC2) do
81
81
  # linux hosts
82
82
  # @return [Boolean] do we have a Xen Identifying Number or not?
83
83
  def has_ec2_identifying_number?
84
- if RUBY_PLATFORM =~ /mswin|mingw32|windows/
84
+ if RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
85
85
  require "wmi-lite/wmi"
86
86
  wmi = WmiLite::Wmi.new
87
- if wmi.first_of("Win32_ComputerSystemProduct")["identifyingnumber"] =~ /^ec2/
87
+ if /^ec2/.match?(wmi.first_of("Win32_ComputerSystemProduct")["identifyingnumber"])
88
88
  logger.trace("Plugin EC2: has_ec2_identifying_number? == true")
89
89
  true
90
90
  end
@@ -42,7 +42,7 @@ Ohai.plugin(:Eucalyptus) do
42
42
  def has_euca_mac?
43
43
  network[:interfaces].each_value do |iface|
44
44
  mac = get_mac_address(iface[:addresses])
45
- if mac =~ /^[dD]0:0[dD]:/
45
+ if /^[dD]0:0[dD]:/.match?(mac)
46
46
  logger.trace("Plugin Eucalyptus: has_euca_mac? == true (#{mac})")
47
47
  return true
48
48
  end
@@ -27,7 +27,7 @@ Ohai.plugin(:GCE) do
27
27
  # this works even if the system lacks dmidecode use by the Dmi plugin
28
28
  # @return [Boolean] do we have Google Compute Engine DMI data?
29
29
  def has_gce_dmi?
30
- if file_val_if_exists("/sys/class/dmi/id/product_name") =~ /Google Compute Engine/
30
+ if /Google Compute Engine/.match?(file_val_if_exists("/sys/class/dmi/id/product_name"))
31
31
  logger.trace("Plugin GCE: has_gce_dmi? == true")
32
32
  true
33
33
  else
@@ -48,7 +48,7 @@ Ohai.plugin(:GCE) do
48
48
  # looks at the Manufacturer and Model WMI values to see if they starts with Google.
49
49
  # @return [Boolean] Are the manufacturer and model Google?
50
50
  def has_gce_system_info?
51
- if RUBY_PLATFORM =~ /mswin|mingw32|windows/
51
+ if RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
52
52
  require "wmi-lite/wmi"
53
53
  wmi = WmiLite::Wmi.new
54
54
  computer_system = wmi.first_of("Win32_ComputerSystem")
@@ -171,14 +171,14 @@ Ohai.plugin(:Hostname) do
171
171
  machinename host["name"].to_s
172
172
 
173
173
  info = Socket.gethostbyname(Socket.gethostname)
174
- if info.first =~ /.+?\.(.*)/
174
+ if /.+?\.(.*)/.match?(info.first)
175
175
  fqdn info.first
176
176
  else
177
177
  # host is not in dns. optionally use:
178
178
  # C:\WINDOWS\system32\drivers\etc\hosts
179
179
  info[3..info.length].reverse_each do |addr|
180
180
  hostent = Socket.gethostbyaddr(addr)
181
- if hostent.first =~ /.+?\.(.*)/
181
+ if /.+?\.(.*)/.match?(hostent.first)
182
182
  fqdn hostent.first
183
183
  break
184
184
  end
@@ -65,7 +65,7 @@ Ohai.plugin(:Interrupts) do
65
65
  interrupts[:irq][irqn][:events_by_cpu][cpu] = fields[cpu].to_i
66
66
  end
67
67
  # Only regular IRQs have extra fields and affinity settings
68
- if /^\d+$/.match(irqn)
68
+ if /^\d+$/.match?(irqn)
69
69
  interrupts[:irq][irqn][:type],
70
70
  interrupts[:irq][irqn][:vector],
71
71
  interrupts[:irq][irqn][:device] =
@@ -78,7 +78,7 @@ Ohai.plugin(:Network) do
78
78
  so.stdout.lines do |line|
79
79
  line.strip!
80
80
  logger.trace("Plugin Network: Parsing #{line}")
81
- if line =~ /\\/
81
+ if /\\/.match?(line)
82
82
  parts = line.split('\\')
83
83
  route_dest = parts.shift.strip
84
84
  route_endings = parts
@@ -191,11 +191,11 @@ Ohai.plugin(:Network) do
191
191
  next if line.start_with?("Ring parameters for")
192
192
  next if line.strip.nil?
193
193
 
194
- if line =~ /Pre-set maximums/
194
+ if /Pre-set maximums/.match?(line)
195
195
  type = "max"
196
196
  next
197
197
  end
198
- if line =~ /Current hardware settings/
198
+ if /Current hardware settings/.match?(line)
199
199
  type = "current"
200
200
  next
201
201
  end
@@ -224,11 +224,11 @@ Ohai.plugin(:Network) do
224
224
  next if line.start_with?("Channel parameters for")
225
225
  next if line.strip.nil?
226
226
 
227
- if line =~ /Pre-set maximums/
227
+ if /Pre-set maximums/.match?(line)
228
228
  type = "max"
229
229
  next
230
230
  end
231
- if line =~ /Current hardware settings/
231
+ if /Current hardware settings/.match?(line)
232
232
  type = "current"
233
233
  next
234
234
  end
@@ -308,7 +308,7 @@ Ohai.plugin(:Network) do
308
308
  net_counters[tmp_int] ||= Mash.new
309
309
  end
310
310
 
311
- if line =~ /^\s+(ip6tnl|ipip)/
311
+ if /^\s+(ip6tnl|ipip)/.match?(line)
312
312
  iface[tmp_int][:tunnel_info] = {}
313
313
  words = line.split
314
314
  words.each_with_index do |word, index|
@@ -195,7 +195,7 @@ Ohai.plugin(:Platform) do
195
195
  elsif File.exist?("/etc/debian_version")
196
196
  # Ubuntu and Debian both have /etc/debian_version
197
197
  # Ubuntu should always have a working lsb, debian does not by default
198
- if lsb[:id] =~ /Ubuntu/i
198
+ if /Ubuntu/i.match?(lsb[:id])
199
199
  platform "ubuntu"
200
200
  platform_version lsb[:release]
201
201
  else
@@ -222,7 +222,7 @@ Ohai.plugin(:Platform) do
222
222
  suse_version = suse_release.scan(/VERSION = (\d+)\nPATCHLEVEL = (\d+)/).flatten.join(".")
223
223
  suse_version = suse_release[/VERSION = ([\d\.]{2,})/, 1] if suse_version == ""
224
224
  platform_version suse_version
225
- if suse_release =~ /^openSUSE/
225
+ if /^openSUSE/.match?(suse_release)
226
226
  # opensuse releases >= 42 are openSUSE Leap
227
227
  if platform_version.to_i < 42
228
228
  platform "opensuse"
@@ -256,23 +256,23 @@ Ohai.plugin(:Platform) do
256
256
  platform_version shell_out("/bin/uname -r").stdout.strip
257
257
  elsif File.exist?("/usr/lib/os-release")
258
258
  contents = File.read("/usr/lib/os-release")
259
- if /clear-linux-os/ =~ contents # Clear Linux https://clearlinux.org/
259
+ if /clear-linux-os/.match?(contents) # Clear Linux https://clearlinux.org/
260
260
  platform "clearlinux"
261
261
  platform_version contents[/VERSION_ID=(\d+)/, 1]
262
262
  end
263
- elsif lsb[:id] =~ /RedHat/i
263
+ elsif /RedHat/i.match?(lsb[:id])
264
264
  platform "redhat"
265
265
  platform_version lsb[:release]
266
- elsif lsb[:id] =~ /Amazon/i
266
+ elsif /Amazon/i.match?(lsb[:id])
267
267
  platform "amazon"
268
268
  platform_version lsb[:release]
269
- elsif lsb[:id] =~ /ScientificSL/i
269
+ elsif /ScientificSL/i.match?(lsb[:id])
270
270
  platform "scientific"
271
271
  platform_version lsb[:release]
272
- elsif lsb[:id] =~ /XenServer/i
272
+ elsif /XenServer/i.match?(lsb[:id])
273
273
  platform "xenserver"
274
274
  platform_version lsb[:release]
275
- elsif lsb[:id] =~ /XCP/i
275
+ elsif /XCP/i.match?(lsb[:id])
276
276
  platform "xcp"
277
277
  platform_version lsb[:release]
278
278
  elsif lsb[:id] # LSB can provide odd data that changes between releases, so we currently fall back on it rather than dealing with its subtleties
@@ -59,7 +59,7 @@ Ohai.plugin(:Virtualization) do
59
59
 
60
60
  # This file should exist on most Xen systems, normally empty for guests
61
61
  if File.exist?("/proc/xen/capabilities")
62
- if File.read("/proc/xen/capabilities") =~ /control_d/i
62
+ if /control_d/i.match?(File.read("/proc/xen/capabilities"))
63
63
  logger.trace("Plugin Virtualization: /proc/xen/capabilities contains control_d. Detecting as Xen host")
64
64
  virtualization[:role] = "host"
65
65
  virtualization[:systems][:xen] = "host"
@@ -70,12 +70,12 @@ Ohai.plugin(:Virtualization) do
70
70
  # Detect Virtualbox from kernel module
71
71
  if File.exist?("/proc/modules")
72
72
  modules = File.read("/proc/modules")
73
- if modules =~ /^vboxdrv/
73
+ if /^vboxdrv/.match?(modules)
74
74
  logger.trace("Plugin Virtualization: /proc/modules contains vboxdrv. Detecting as vbox host")
75
75
  virtualization[:system] = "vbox"
76
76
  virtualization[:role] = "host"
77
77
  virtualization[:systems][:vbox] = "host"
78
- elsif modules =~ /^vboxguest/
78
+ elsif /^vboxguest/.match?(modules)
79
79
  logger.trace("Plugin Virtualization: /proc/modules contains vboxguest. Detecting as vbox guest")
80
80
  virtualization[:system] = "vbox"
81
81
  virtualization[:role] = "guest"
@@ -93,7 +93,7 @@ Ohai.plugin(:Virtualization) do
93
93
 
94
94
  # Detect paravirt KVM/QEMU from cpuinfo, report as KVM
95
95
  if File.exist?("/proc/cpuinfo")
96
- if File.read("/proc/cpuinfo") =~ /QEMU Virtual CPU|Common KVM processor|Common 32-bit KVM processor/
96
+ if /QEMU Virtual CPU|Common KVM processor|Common 32-bit KVM processor/.match?(File.read("/proc/cpuinfo"))
97
97
  logger.trace("Plugin Virtualization: /proc/cpuinfo lists a KVM paravirt CPU string. Detecting as kvm guest")
98
98
  virtualization[:system] = "kvm"
99
99
  virtualization[:role] = "guest"
@@ -105,7 +105,7 @@ Ohai.plugin(:Virtualization) do
105
105
  # guests will have the hypervisor cpu feature that hosts don't have
106
106
  if File.exist?("/sys/devices/virtual/misc/kvm")
107
107
  virtualization[:system] = "kvm"
108
- if File.read("/proc/cpuinfo") =~ /hypervisor/
108
+ if /hypervisor/.match?(File.read("/proc/cpuinfo"))
109
109
  logger.trace("Plugin Virtualization: /sys/devices/virtual/misc/kvm present and /proc/cpuinfo lists the hypervisor feature. Detecting as kvm guest")
110
110
  virtualization[:role] = "guest"
111
111
  virtualization[:systems][:kvm] = "guest"
@@ -199,12 +199,12 @@ Ohai.plugin(:Virtualization) do
199
199
  virtualization[:system] = $1
200
200
  virtualization[:role] = "guest"
201
201
  virtualization[:systems][$1.to_sym] = "guest"
202
- elsif File.read("/proc/1/environ") =~ /container=lxc/
202
+ elsif /container=lxc/.match?(File.read("/proc/1/environ"))
203
203
  logger.trace("Plugin Virtualization: /proc/1/environ indicates lxc container. Detecting as lxc guest")
204
204
  virtualization[:system] = "lxc"
205
205
  virtualization[:role] = "guest"
206
206
  virtualization[:systems][:lxc] = "guest"
207
- elsif File.read("/proc/1/environ") =~ /container=systemd-nspawn/
207
+ elsif /container=systemd-nspawn/.match?(File.read("/proc/1/environ"))
208
208
  logger.trace("Plugin Virtualization: /proc/1/environ indicates nspawn container. Detecting as nspawn guest")
209
209
  virtualization[:system] = "nspawn"
210
210
  virtualization[:role] = "guest"
@@ -54,7 +54,7 @@ Ohai.plugin(:NetworkAddresses) do
54
54
  ipaddresses.sort_by do |v|
55
55
  [ ( scope_prio.index(v[:scope]) || 999999 ),
56
56
  128 - v[:ipaddress].prefix.to_i,
57
- ( family == "inet" ? v[:ipaddress].to_u32 : v[:ipaddress].to_u128 ),
57
+ v[:ipaddress].to_i,
58
58
  ]
59
59
  end
60
60
  end
@@ -49,7 +49,7 @@ Ohai.plugin(:Openstack) do
49
49
  # https://help.dreamhost.com/hc/en-us/articles/228377408-How-to-find-the-default-user-of-an-image
50
50
  def openstack_provider
51
51
  # dream host doesn't support windows so bail early if we're on windows
52
- return "openstack" if RUBY_PLATFORM =~ /mswin|mingw32|windows/
52
+ return "openstack" if RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
53
53
 
54
54
  if Etc::Passwd.entries.map(&:name).include?("dhc-user")
55
55
  "dreamhost"
@@ -48,7 +48,7 @@ Ohai.plugin(:Rackspace) do
48
48
  # true:: If the rackspace cloud can be identified
49
49
  # false:: Otherwise
50
50
  def has_rackspace_manufacturer?
51
- return false unless RUBY_PLATFORM =~ /mswin|mingw32|windows/
51
+ return false unless RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
52
52
 
53
53
  require "wmi-lite/wmi"
54
54
  wmi = WmiLite::Wmi.new
@@ -102,7 +102,7 @@ Ohai.plugin(:Rackspace) do
102
102
  so = shell_out("xenstore-ls vm-data/provider_data")
103
103
  if so.exitstatus == 0
104
104
  so.stdout.split("\n").each do |line|
105
- rackspace[:region] = line.split[2].delete('\"') if line =~ /^region/
105
+ rackspace[:region] = line.split[2].delete('\"') if /^region/.match?(line)
106
106
  end
107
107
  end
108
108
  rescue Ohai::Exceptions::Exec
@@ -38,7 +38,7 @@ Ohai.plugin(:Virtualization) do
38
38
  psrinfo_path = Ohai.abs_path( "/usr/sbin/psrinfo" )
39
39
  if File.exist?(psrinfo_path)
40
40
  so = shell_out("#{psrinfo_path} -pv")
41
- if so.stdout =~ /QEMU Virtual CPU|Common KVM processor|Common 32-bit KVM processor/
41
+ if /QEMU Virtual CPU|Common KVM processor|Common 32-bit KVM processor/.match?(so.stdout)
42
42
  virtualization[:system] = "kvm"
43
43
  virtualization[:role] = "guest"
44
44
  virtualization[:systems][:kvm] = "guest"
@@ -51,7 +51,7 @@ Ohai.plugin(:SSHHostKey) do
51
51
  if sshd_config
52
52
  File.open(sshd_config) do |conf|
53
53
  conf.each_line do |line|
54
- if line =~ /^hostkey\s/i
54
+ if /^hostkey\s/i.match?(line)
55
55
  pub_file = "#{line.split[1]}.pub"
56
56
  content = IO.read(pub_file).split
57
57
  key_type, key_subtype = extract_keytype?(content)
@@ -51,7 +51,7 @@ Ohai.plugin(:VMware) do
51
51
  # to attribute "vmware[:<parameter>]"
52
52
  %w{hosttime speed sessionid balloon swap memlimit memres cpures cpulimit}.each do |param|
53
53
  vmware[param] = from_cmd("#{vmtools_path} stat #{param}")
54
- if vmware[param] =~ /UpdateInfo failed/
54
+ if /UpdateInfo failed/.match?(vmware[param])
55
55
  vmware[param] = nil
56
56
  end
57
57
  end
@@ -171,7 +171,7 @@ Ohai.plugin(:Network) do
171
171
  iface[cint][:addresses][ip] = Mash.new(prefixlen: ip2.prefix)
172
172
  if ip2.ipv6?
173
173
  iface[cint][:addresses][ip][:family] = "inet6"
174
- iface[cint][:addresses][ip][:scope] = "Link" if ip =~ /^fe80/i
174
+ iface[cint][:addresses][ip][:scope] = "Link" if /^fe80/i.match?(ip)
175
175
  else
176
176
  if iface[cint][:configuration][:ip_subnet]
177
177
  iface[cint][:addresses][ip][:netmask] = ip2.netmask.to_s
@@ -136,8 +136,8 @@ module Ohai
136
136
  private
137
137
 
138
138
  def normalize_and_validate(attribute)
139
- raise Ohai::Exceptions::AttributeSyntaxError, "Attribute contains duplicate '/' characters: #{attribute}" if attribute =~ %r{//+}
140
- raise Ohai::Exceptions::AttributeSyntaxError, "Attribute contains a trailing '/': #{attribute}" if attribute =~ %r{/$}
139
+ raise Ohai::Exceptions::AttributeSyntaxError, "Attribute contains duplicate '/' characters: #{attribute}" if %r{//+}.match?(attribute)
140
+ raise Ohai::Exceptions::AttributeSyntaxError, "Attribute contains a trailing '/': #{attribute}" if %r{/$}.match?(attribute)
141
141
 
142
142
  parts = attribute.split("/")
143
143
  parts.shift if parts.length != 0 && parts[0].length == 0 # attribute begins with a '/'
@@ -19,7 +19,7 @@
19
19
  module Ohai
20
20
  module Util
21
21
  module Win32
22
- if RUBY_PLATFORM =~ /mswin|mingw|windows/
22
+ if RUBY_PLATFORM.match?(/mswin|mingw|windows/)
23
23
 
24
24
  require "ffi" unless defined?(FFI)
25
25
 
@@ -18,5 +18,5 @@
18
18
 
19
19
  module Ohai
20
20
  OHAI_ROOT = File.expand_path(File.dirname(__FILE__))
21
- VERSION = "16.2.3".freeze
21
+ VERSION = "16.3.0".freeze
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohai
3
3
  version: !ruby/object:Gem::Version
4
- version: 16.2.3
4
+ version: 16.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-30 00:00:00.000000000 Z
11
+ date: 2020-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu