ohai 16.2.0 → 16.4.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/bin/ohai +0 -2
  4. data/lib/ohai/application.rb +2 -2
  5. data/lib/ohai/dsl/plugin.rb +1 -1
  6. data/lib/ohai/loader.rb +1 -2
  7. data/lib/ohai/log.rb +1 -1
  8. data/lib/ohai/mixin/command.rb +1 -1
  9. data/lib/ohai/mixin/dmi_decode.rb +2 -2
  10. data/lib/ohai/mixin/os.rb +1 -1
  11. data/lib/ohai/mixin/softlayer_metadata.rb +1 -1
  12. data/lib/ohai/plugins/aix/memory.rb +3 -3
  13. data/lib/ohai/plugins/aix/network.rb +2 -1
  14. data/lib/ohai/plugins/aix/uptime.rb +2 -2
  15. data/lib/ohai/plugins/aix/virtualization.rb +5 -5
  16. data/lib/ohai/plugins/azure.rb +1 -1
  17. data/lib/ohai/plugins/bsd/virtualization.rb +2 -2
  18. data/lib/ohai/plugins/c.rb +2 -2
  19. data/lib/ohai/plugins/cloud.rb +1 -1
  20. data/lib/ohai/plugins/cpu.rb +2 -2
  21. data/lib/ohai/plugins/darwin/hardware.rb +2 -2
  22. data/lib/ohai/plugins/darwin/network.rb +3 -3
  23. data/lib/ohai/plugins/darwin/platform.rb +3 -6
  24. data/lib/ohai/plugins/darwin/virtualization.rb +1 -1
  25. data/lib/ohai/plugins/docker.rb +2 -2
  26. data/lib/ohai/plugins/dragonflybsd/platform.rb +2 -4
  27. data/lib/ohai/plugins/ec2.rb +8 -7
  28. data/lib/ohai/plugins/eucalyptus.rb +1 -1
  29. data/lib/ohai/plugins/filesystem.rb +11 -17
  30. data/lib/ohai/plugins/fips.rb +1 -5
  31. data/lib/ohai/plugins/freebsd/platform.rb +2 -4
  32. data/lib/ohai/plugins/gce.rb +3 -3
  33. data/lib/ohai/plugins/hostname.rb +16 -16
  34. data/lib/ohai/plugins/kernel.rb +1 -1
  35. data/lib/ohai/plugins/linux/hostnamectl.rb +1 -2
  36. data/lib/ohai/plugins/linux/interrupts.rb +1 -1
  37. data/lib/ohai/plugins/linux/lsb.rb +1 -2
  38. data/lib/ohai/plugins/linux/lspci.rb +1 -2
  39. data/lib/ohai/plugins/linux/machineid.rb +2 -2
  40. data/lib/ohai/plugins/linux/mdadm.rb +1 -1
  41. data/lib/ohai/plugins/linux/network.rb +19 -9
  42. data/lib/ohai/plugins/linux/platform.rb +22 -25
  43. data/lib/ohai/plugins/linux/virtualization.rb +12 -9
  44. data/lib/ohai/plugins/netbsd/network.rb +4 -8
  45. data/lib/ohai/plugins/netbsd/platform.rb +2 -4
  46. data/lib/ohai/plugins/network.rb +5 -4
  47. data/lib/ohai/plugins/openbsd/network.rb +4 -8
  48. data/lib/ohai/plugins/openbsd/platform.rb +2 -4
  49. data/lib/ohai/plugins/openstack.rb +3 -2
  50. data/lib/ohai/plugins/packages.rb +1 -1
  51. data/lib/ohai/plugins/passwd.rb +2 -1
  52. data/lib/ohai/plugins/rackspace.rb +5 -4
  53. data/lib/ohai/plugins/root_group.rb +1 -1
  54. data/lib/ohai/plugins/ruby.rb +4 -15
  55. data/lib/ohai/plugins/scaleway.rb +1 -1
  56. data/lib/ohai/plugins/shard.rb +1 -1
  57. data/lib/ohai/plugins/solaris2/dmi.rb +2 -3
  58. data/lib/ohai/plugins/solaris2/memory.rb +1 -2
  59. data/lib/ohai/plugins/solaris2/network.rb +2 -6
  60. data/lib/ohai/plugins/solaris2/platform.rb +1 -2
  61. data/lib/ohai/plugins/solaris2/virtualization.rb +3 -6
  62. data/lib/ohai/plugins/ssh_host_key.rb +1 -1
  63. data/lib/ohai/plugins/uptime.rb +1 -1
  64. data/lib/ohai/plugins/vmware.rb +2 -2
  65. data/lib/ohai/plugins/windows/dmi.rb +2 -2
  66. data/lib/ohai/plugins/windows/drivers.rb +1 -1
  67. data/lib/ohai/plugins/windows/memory.rb +1 -1
  68. data/lib/ohai/plugins/windows/network.rb +3 -3
  69. data/lib/ohai/plugins/windows/platform.rb +1 -1
  70. data/lib/ohai/plugins/windows/virtualization.rb +1 -1
  71. data/lib/ohai/provides_map.rb +2 -2
  72. data/lib/ohai/runner.rb +1 -1
  73. data/lib/ohai/util/ip_helper.rb +2 -2
  74. data/lib/ohai/util/win32.rb +1 -1
  75. data/lib/ohai/version.rb +1 -1
  76. data/ohai.gemspec +0 -1
  77. metadata +2 -16
@@ -25,9 +25,7 @@ Ohai.plugin(:Virtualization) do
25
25
  depends "dmi"
26
26
 
27
27
  def collect_solaris_guestid
28
- command = "/usr/sbin/zoneadm list -p"
29
- so = shell_out(command)
30
- so.stdout.split(":").first
28
+ shell_out("/usr/sbin/zoneadm list -p").stdout.split(":").first
31
29
  end
32
30
 
33
31
  collect_data(:solaris2) do
@@ -38,7 +36,7 @@ Ohai.plugin(:Virtualization) do
38
36
  psrinfo_path = Ohai.abs_path( "/usr/sbin/psrinfo" )
39
37
  if File.exist?(psrinfo_path)
40
38
  so = shell_out("#{psrinfo_path} -pv")
41
- if so.stdout =~ /QEMU Virtual CPU|Common KVM processor|Common 32-bit KVM processor/
39
+ if /QEMU Virtual CPU|Common KVM processor|Common 32-bit KVM processor/.match?(so.stdout)
42
40
  virtualization[:system] = "kvm"
43
41
  virtualization[:role] = "guest"
44
42
  virtualization[:systems][:kvm] = "guest"
@@ -56,8 +54,7 @@ Ohai.plugin(:Virtualization) do
56
54
 
57
55
  if File.executable?("/usr/sbin/zoneadm")
58
56
  zones = Mash.new
59
- so = shell_out("zoneadm list -pc")
60
- so.stdout.lines do |line|
57
+ shell_out("zoneadm list -pc").stdout.lines do |line|
61
58
  info = line.chomp.split(/:/)
62
59
  zones[info[1]] = {
63
60
  "id" => info[0],
@@ -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)
@@ -84,7 +84,7 @@ Ohai.plugin(:Uptime) do
84
84
  end
85
85
 
86
86
  collect_data(:windows) do
87
- require "wmi-lite/wmi"
87
+ require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
88
88
  wmi = WmiLite::Wmi.new
89
89
  last_boot_up_time = wmi.first_of("Win32_OperatingSystem")["lastbootuptime"]
90
90
  uptime_seconds Time.new.to_i - Time.parse(last_boot_up_time).to_i
@@ -51,12 +51,12 @@ 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
58
58
  # vmware-toolbox-cmd <param> status commands
59
- # Iterate through each parameter supported by the "vwware-toolbox-cmd status" command, assign value
59
+ # Iterate through each parameter supported by the "vmware-toolbox-cmd status" command, assign value
60
60
  # to attribute "vmware[:<parameter>]"
61
61
  %w{upgrade timesync}.each do |param|
62
62
  vmware[param] = from_cmd("#{vmtools_path} #{param} status")
@@ -45,8 +45,8 @@ Ohai.plugin(:DMI) do
45
45
  ].freeze
46
46
 
47
47
  collect_data(:windows) do
48
- require "ohai/common/dmi"
49
- require "wmi-lite/wmi"
48
+ require_relative "../../common/dmi"
49
+ require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
50
50
  wmi = WmiLite::Wmi.new
51
51
 
52
52
  dmi Mash.new
@@ -22,7 +22,7 @@ Ohai.plugin(:Drivers) do
22
22
  collect_data(:windows) do
23
23
  if configuration(:enabled)
24
24
 
25
- require "wmi-lite/wmi"
25
+ require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
26
26
 
27
27
  kext = Mash.new
28
28
  pnp_drivers = Mash.new
@@ -17,7 +17,7 @@ Ohai.plugin(:Memory) do
17
17
  provides "memory"
18
18
 
19
19
  collect_data(:windows) do
20
- require "wmi-lite/wmi"
20
+ require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
21
21
 
22
22
  memory Mash.new
23
23
  memory[:swap] = Mash.new
@@ -93,7 +93,7 @@ Ohai.plugin(:Network) do
93
93
 
94
94
  # Selects default interface and returns its information
95
95
  #
96
- # @note Interface with least metric value should be prefered as default_route
96
+ # @note Interface with least metric value should be preferred as default_route
97
97
  #
98
98
  # @param configuration [Mash] Configuration of interfaces as iface_config
99
99
  # [<interface_index> => {<interface_configurations>}]
@@ -118,7 +118,7 @@ Ohai.plugin(:Network) do
118
118
 
119
119
  collect_data(:windows) do
120
120
 
121
- require "wmi-lite/wmi"
121
+ require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
122
122
 
123
123
  iface = Mash.new
124
124
  iface_config = Mash.new
@@ -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
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- # After long discussion in IRC the "powers that be" have come to a concensus
19
+ # After long discussion in IRC the "powers that be" have come to a consensus
20
20
  # that there is no other Windows platforms exist that were not based on the
21
21
  # Windows_NT kernel, so we herby decree that "windows" will refer to all
22
22
  # platforms built upon the Windows_NT kernel and have access to win32 or win64
@@ -24,7 +24,7 @@ Ohai.plugin(:Virtualization) do
24
24
  include Ohai::Mixin::DmiDecode
25
25
 
26
26
  collect_data(:windows) do
27
- require "wmi-lite/wmi"
27
+ require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
28
28
 
29
29
  virtualization Mash.new unless virtualization
30
30
  virtualization[:systems] ||= Mash.new
@@ -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 '/'
@@ -18,7 +18,7 @@
18
18
  #
19
19
 
20
20
  require_relative "dsl"
21
- require "benchmark"
21
+ require "benchmark" unless defined?(Benchmark)
22
22
 
23
23
  module Ohai
24
24
  class Runner
@@ -14,11 +14,11 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
- require "ipaddress"
18
-
19
17
  module Ohai
20
18
  module Util
21
19
  module IpHelper
20
+ require "ipaddress" unless defined?(IPAddress)
21
+
22
22
  # Corresponding to RFC 4192 + RFC 4193
23
23
  IPV6_LINK_LOCAL_UNICAST_BLOCK = IPAddress("fe80::/10")
24
24
  IPV6_PRIVATE_ADDRESS_BLOCK = IPAddress("fc00::/7")
@@ -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.0".freeze
21
+ VERSION = "16.4.11".freeze
22
22
  end
@@ -14,7 +14,6 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.required_ruby_version = ">= 2.5"
16
16
 
17
- s.add_dependency "systemu", "~> 2.6.4"
18
17
  s.add_dependency "ffi-yajl", "~> 2.2"
19
18
  s.add_dependency "mixlib-cli", ">= 1.7.0" # 1.7+ needed to support passing multiple options
20
19
  s.add_dependency "mixlib-config", ">= 2.0", "< 4.0"
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohai
3
3
  version: !ruby/object:Gem::Version
4
- version: 16.2.0
4
+ version: 16.4.11
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-17 00:00:00.000000000 Z
11
+ date: 2020-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: systemu
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 2.6.4
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 2.6.4
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: ffi-yajl
29
15
  requirement: !ruby/object:Gem::Requirement