ohai 16.5.4 → 16.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -8
  3. data/bin/ohai +1 -0
  4. data/lib/ohai.rb +1 -0
  5. data/lib/ohai/application.rb +40 -0
  6. data/lib/ohai/common/dmi.rb +8 -3
  7. data/lib/ohai/config.rb +1 -0
  8. data/lib/ohai/dsl.rb +1 -0
  9. data/lib/ohai/dsl/plugin.rb +9 -1
  10. data/lib/ohai/dsl/plugin/versionvii.rb +28 -17
  11. data/lib/ohai/exception.rb +1 -0
  12. data/lib/ohai/hints.rb +1 -0
  13. data/lib/ohai/log.rb +1 -0
  14. data/lib/ohai/mash.rb +1 -0
  15. data/lib/ohai/mixin/azure_metadata.rb +4 -3
  16. data/lib/ohai/mixin/chef_utils_wiring.rb +14 -1
  17. data/lib/ohai/mixin/command.rb +1 -0
  18. data/lib/ohai/mixin/constant_helper.rb +1 -0
  19. data/lib/ohai/mixin/dmi_decode.rb +1 -0
  20. data/lib/ohai/mixin/do_metadata.rb +3 -2
  21. data/lib/ohai/mixin/ec2_metadata.rb +10 -9
  22. data/lib/ohai/mixin/gce_metadata.rb +4 -3
  23. data/lib/ohai/mixin/http_helper.rb +1 -0
  24. data/lib/ohai/mixin/network_helper.rb +1 -0
  25. data/lib/ohai/mixin/os.rb +67 -1
  26. data/lib/ohai/mixin/scaleway_metadata.rb +3 -2
  27. data/lib/ohai/mixin/seconds_to_human.rb +1 -0
  28. data/lib/ohai/mixin/shell_out.rb +1 -0
  29. data/lib/ohai/mixin/softlayer_metadata.rb +2 -1
  30. data/lib/ohai/mixin/string.rb +1 -0
  31. data/lib/ohai/mixin/train_helpers.rb +36 -0
  32. data/lib/ohai/mixin/which.rb +1 -0
  33. data/lib/ohai/plugin_config.rb +1 -0
  34. data/lib/ohai/plugins/aix/kernel.rb +7 -4
  35. data/lib/ohai/plugins/aix/memory.rb +4 -3
  36. data/lib/ohai/plugins/aix/network.rb +51 -58
  37. data/lib/ohai/plugins/aix/platform.rb +3 -2
  38. data/lib/ohai/plugins/aix/uptime.rb +3 -2
  39. data/lib/ohai/plugins/aix/virtualization.rb +6 -6
  40. data/lib/ohai/plugins/azure.rb +25 -4
  41. data/lib/ohai/plugins/bsd/virtualization.rb +3 -2
  42. data/lib/ohai/plugins/c.rb +4 -3
  43. data/lib/ohai/plugins/chef.rb +2 -1
  44. data/lib/ohai/plugins/cloud.rb +2 -1
  45. data/lib/ohai/plugins/command.rb +1 -0
  46. data/lib/ohai/plugins/cpu.rb +31 -32
  47. data/lib/ohai/plugins/darwin/hardware.rb +1 -0
  48. data/lib/ohai/plugins/darwin/memory.rb +2 -3
  49. data/lib/ohai/plugins/darwin/network.rb +8 -9
  50. data/lib/ohai/plugins/darwin/platform.rb +1 -0
  51. data/lib/ohai/plugins/darwin/virtualization.rb +2 -1
  52. data/lib/ohai/plugins/digital_ocean.rb +3 -1
  53. data/lib/ohai/plugins/dmi.rb +6 -5
  54. data/lib/ohai/plugins/docker.rb +2 -1
  55. data/lib/ohai/plugins/dragonflybsd/memory.rb +9 -8
  56. data/lib/ohai/plugins/dragonflybsd/network.rb +1 -0
  57. data/lib/ohai/plugins/dragonflybsd/platform.rb +3 -2
  58. data/lib/ohai/plugins/ec2.rb +14 -7
  59. data/lib/ohai/plugins/elixir.rb +1 -1
  60. data/lib/ohai/plugins/erlang.rb +1 -0
  61. data/lib/ohai/plugins/eucalyptus.rb +4 -1
  62. data/lib/ohai/plugins/filesystem.rb +4 -4
  63. data/lib/ohai/plugins/fips.rb +1 -0
  64. data/lib/ohai/plugins/freebsd/memory.rb +9 -8
  65. data/lib/ohai/plugins/freebsd/network.rb +1 -0
  66. data/lib/ohai/plugins/freebsd/platform.rb +3 -2
  67. data/lib/ohai/plugins/gce.rb +3 -2
  68. data/lib/ohai/plugins/go.rb +1 -1
  69. data/lib/ohai/plugins/groovy.rb +1 -1
  70. data/lib/ohai/plugins/grub2.rb +40 -0
  71. data/lib/ohai/plugins/haskell.rb +1 -0
  72. data/lib/ohai/plugins/hostname.rb +2 -2
  73. data/lib/ohai/plugins/init_package.rb +2 -1
  74. data/lib/ohai/plugins/java.rb +1 -0
  75. data/lib/ohai/plugins/kernel.rb +14 -11
  76. data/lib/ohai/plugins/keys.rb +1 -0
  77. data/lib/ohai/plugins/languages.rb +1 -0
  78. data/lib/ohai/plugins/libvirt.rb +4 -3
  79. data/lib/ohai/plugins/linode.rb +22 -14
  80. data/lib/ohai/plugins/linux/block_device.rb +9 -8
  81. data/lib/ohai/plugins/linux/hostnamectl.rb +3 -2
  82. data/lib/ohai/plugins/linux/interrupts.rb +4 -3
  83. data/lib/ohai/plugins/linux/ipc.rb +2 -1
  84. data/lib/ohai/plugins/linux/lsb.rb +7 -20
  85. data/lib/ohai/plugins/linux/lspci.rb +1 -1
  86. data/lib/ohai/plugins/linux/machineid.rb +5 -4
  87. data/lib/ohai/plugins/linux/mdadm.rb +3 -2
  88. data/lib/ohai/plugins/linux/memory.rb +38 -37
  89. data/lib/ohai/plugins/linux/network.rb +7 -6
  90. data/lib/ohai/plugins/linux/platform.rb +31 -30
  91. data/lib/ohai/plugins/linux/selinux.rb +1 -0
  92. data/lib/ohai/plugins/linux/sessions.rb +1 -0
  93. data/lib/ohai/plugins/linux/sysctl.rb +1 -0
  94. data/lib/ohai/plugins/linux/systemd_paths.rb +1 -0
  95. data/lib/ohai/plugins/linux/virtualization.rb +24 -23
  96. data/lib/ohai/plugins/lua.rb +1 -1
  97. data/lib/ohai/plugins/mono.rb +1 -1
  98. data/lib/ohai/plugins/netbsd/memory.rb +1 -0
  99. data/lib/ohai/plugins/netbsd/network.rb +1 -0
  100. data/lib/ohai/plugins/netbsd/platform.rb +3 -2
  101. data/lib/ohai/plugins/network.rb +2 -1
  102. data/lib/ohai/plugins/nodejs.rb +1 -1
  103. data/lib/ohai/plugins/ohai.rb +1 -0
  104. data/lib/ohai/plugins/ohai_time.rb +2 -1
  105. data/lib/ohai/plugins/openbsd/memory.rb +1 -0
  106. data/lib/ohai/plugins/openbsd/network.rb +1 -0
  107. data/lib/ohai/plugins/openbsd/platform.rb +3 -2
  108. data/lib/ohai/plugins/openstack.rb +1 -0
  109. data/lib/ohai/plugins/os.rb +6 -1
  110. data/lib/ohai/plugins/packages.rb +2 -1
  111. data/lib/ohai/plugins/passwd.rb +58 -1
  112. data/lib/ohai/plugins/perl.rb +1 -1
  113. data/lib/ohai/plugins/php.rb +1 -1
  114. data/lib/ohai/plugins/platform.rb +1 -0
  115. data/lib/ohai/plugins/powershell.rb +1 -1
  116. data/lib/ohai/plugins/ps.rb +1 -0
  117. data/lib/ohai/plugins/python.rb +1 -1
  118. data/lib/ohai/plugins/rackspace.rb +6 -5
  119. data/lib/ohai/plugins/root_group.rb +1 -0
  120. data/lib/ohai/plugins/ruby.rb +3 -2
  121. data/lib/ohai/plugins/rust.rb +1 -1
  122. data/lib/ohai/plugins/scala.rb +1 -0
  123. data/lib/ohai/plugins/scaleway.rb +3 -2
  124. data/lib/ohai/plugins/scsi.rb +1 -1
  125. data/lib/ohai/plugins/shard.rb +1 -1
  126. data/lib/ohai/plugins/shells.rb +3 -2
  127. data/lib/ohai/plugins/softlayer.rb +1 -0
  128. data/lib/ohai/plugins/solaris2/dmi.rb +2 -1
  129. data/lib/ohai/plugins/solaris2/memory.rb +1 -0
  130. data/lib/ohai/plugins/solaris2/network.rb +2 -1
  131. data/lib/ohai/plugins/solaris2/platform.rb +8 -14
  132. data/lib/ohai/plugins/solaris2/virtualization.rb +4 -4
  133. data/lib/ohai/plugins/ssh_host_key.rb +13 -12
  134. data/lib/ohai/plugins/sysconf.rb +1 -0
  135. data/lib/ohai/plugins/timezone.rb +1 -0
  136. data/lib/ohai/plugins/train.rb +35 -0
  137. data/lib/ohai/plugins/uptime.rb +2 -1
  138. data/lib/ohai/plugins/virtualbox.rb +2 -1
  139. data/lib/ohai/plugins/vmware.rb +3 -3
  140. data/lib/ohai/plugins/windows/dmi.rb +1 -0
  141. data/lib/ohai/plugins/windows/drivers.rb +1 -0
  142. data/lib/ohai/plugins/windows/memory.rb +1 -0
  143. data/lib/ohai/plugins/windows/network.rb +2 -1
  144. data/lib/ohai/plugins/windows/platform.rb +1 -0
  145. data/lib/ohai/plugins/windows/system_enclosure.rb +1 -0
  146. data/lib/ohai/plugins/windows/virtualization.rb +1 -0
  147. data/lib/ohai/plugins/zpools.rb +5 -3
  148. data/lib/ohai/provides_map.rb +1 -0
  149. data/lib/ohai/runner.rb +7 -4
  150. data/lib/ohai/system.rb +33 -4
  151. data/lib/ohai/train_transport.rb +29 -0
  152. data/lib/ohai/util/file_helper.rb +1 -0
  153. data/lib/ohai/util/ip_helper.rb +2 -1
  154. data/lib/ohai/util/win32.rb +1 -0
  155. data/lib/ohai/version.rb +2 -1
  156. data/ohai.gemspec +3 -1
  157. metadata +21 -4
  158. data/lib/ohai/plugins/joyent.rb +0 -77
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Davide Cavalca <dcavalca@fb.com>
3
4
  # Copyright:: Copyright (c) 2016 Facebook
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: John Bellone (<jbellone@bloomberg.net>)
3
4
  # License:: Apache License, Version 2.0
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ Ohai.plugin(:Train) do
20
+ provides "train"
21
+
22
+ collect_data do
23
+ if transport_connection
24
+ train Mash.new
25
+ train["family_hierarchy"] = transport_connection.platform.family_hierarchy
26
+ train["family"] = transport_connection.platform.family
27
+ train["platform"] = transport_connection.platform.platform
28
+ train["backend"] = transport_connection.backend_type
29
+ if transport_connection.respond_to?(:uri)
30
+ train["scheme"] = URI.parse(transport_connection.uri).scheme
31
+ train["uri"] = transport_connection.uri
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Adam Jacob (<adam@chef.io>)
3
4
  # Author:: Bryan McLellan (<btm@loftninjas.org>)
@@ -54,7 +55,7 @@ Ohai.plugin(:Uptime) do
54
55
  end
55
56
 
56
57
  collect_data(:linux) do
57
- uptime, idletime = File.open("/proc/uptime").gets.split(" ")
58
+ uptime, idletime = file_open("/proc/uptime").gets.split
58
59
  uptime_seconds uptime.to_i
59
60
  uptime seconds_to_human(uptime.to_i)
60
61
  idletime_seconds idletime.to_i
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Tim Smith <tsmith@chef.io>
3
4
  # Author:: Joshua Colson <joshua.colson@gmail.com>
@@ -127,7 +128,7 @@ Ohai.plugin(:Virtualbox) do
127
128
  logger.trace("Plugin VboxHost: Could not run '#{so_cmd}'. Skipping data")
128
129
  end
129
130
 
130
- collect_data(:default) do
131
+ collect_data(:windows, :linux, :solaris2, :darwin) do
131
132
  case virtualization.dig("systems", "vbox")
132
133
  when "guest"
133
134
  logger.trace("Plugin Virtualbox: Node detected as vbox guest. Collecting guest data.")
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: "Dan Robinson" <drobinson@chef.io>
3
4
  # Author:: "Christopher M. Luciano" <cmlucian@us.ibm.com>
@@ -36,12 +37,11 @@ Ohai.plugin(:VMware) do
36
37
  depends "virtualization"
37
38
 
38
39
  def from_cmd(cmd)
39
- so = shell_out(cmd)
40
- so.stdout.split($/)[0]
40
+ shell_out(cmd).stdout.strip
41
41
  end
42
42
 
43
43
  def get_vm_attributes(vmtools_path)
44
- if !File.exist?(vmtools_path)
44
+ if !file_exist?(vmtools_path)
45
45
  logger.trace("Plugin VMware: #{vmtools_path} not found")
46
46
  else
47
47
  vmware Mash.new
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Pete Higgins (pete@peterhiggins.org)
3
4
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Copyright:: Copyright (c) Chef Software Inc.
3
4
  # License:: Apache License, Version 2.0
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # License:: Apache License, Version 2.0
3
4
  #
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: James Gartrell (<jgartrel@gmail.com>)
3
4
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -205,7 +206,7 @@ Ohai.plugin(:Network) do
205
206
  so = shell_out("arp -a")
206
207
  if so.exitstatus == 0
207
208
  so.stdout.lines do |line|
208
- if line =~ /^Interface:\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+[-]+\s+(0x\S+)/
209
+ if line =~ /^Interface:\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+-+\s+(0x\S+)/
209
210
  cint = $2.downcase
210
211
  end
211
212
  next unless iface[cint]
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: James Gartrell (<jgartrel@gmail.com>)
3
4
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Stuart Preston (<stuart@chef.io>)
3
4
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Pavel Yudin (<pyudin@parallels.com>)
3
4
  # Author:: Tim Smith (<tsmith@chef.io>)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Jason J. W. Williams (williamsjj@digitar.com)
3
4
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -45,7 +46,6 @@ Ohai.plugin(:Zpools) do
45
46
  pools[$1][:zpool_version] = sanitize_value($8)
46
47
  end
47
48
  end
48
-
49
49
  rescue Ohai::Exceptions::Exec
50
50
  Ohai::Log.debug('Plugin Zpools: Could not shell_out "zpool list -H -o name,size,alloc,free,cap,dedup,health,version". Skipping plugin.')
51
51
  end
@@ -65,7 +65,9 @@ Ohai.plugin(:Zpools) do
65
65
  if platform_family == "solaris2"
66
66
  command = "su adm -c \"zpool status #{pool}\""
67
67
  else
68
- command = "zpool status #{pool}"
68
+ # -L is used to give us real device names not label or uuid
69
+ # for example sda instead of ata-WDC_WD60EZAZ-00SF3B0_WD-WX32D203UXYK
70
+ command = "zpool status #{pool} -L"
69
71
  end
70
72
 
71
73
  so = shell_out(command)
@@ -74,7 +76,7 @@ Ohai.plugin(:Zpools) do
74
76
  # linux: http://rubular.com/r/J3wQC6E2lH
75
77
  # solaris: http://rubular.com/r/FqOBzUQQ4p
76
78
  # freebsd: http://rubular.com/r/RYkMNlytXl
77
- when /^\s+((sd|c|ad|da)[-_a-zA-Z0-9]+)\s+([-_a-zA-Z0-9]+)\s+(\d+)\s+(\d+)\s+(\d+)$/
79
+ when /^\s+((sd|c|ad|da|nvme|xvd)[-_a-zA-Z0-9]+)\s+([-_a-zA-Z0-9]+)\s+(\d+)\s+(\d+)\s+(\d+)$/
78
80
  logger.trace("Plugin Zpools: Parsing zpool status line: #{line.chomp}")
79
81
  pools[pool][:devices][$1] = Mash.new
80
82
  pools[pool][:devices][$1][:state] = $3
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Adam Jacob (<adam@chef.io>)
3
4
  # Author:: Daniel DeLeo (<dan@chef.io>)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Claire McQuin (<claire@chef.io>)
3
4
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -24,6 +25,9 @@ module Ohai
24
25
  class Runner
25
26
 
26
27
  attr_reader :failed_plugins, :logger
28
+
29
+ attr_accessor :transport_connection
30
+
27
31
  # safe_run: set to true if this runner will run plugins in
28
32
  # safe-mode. default false.
29
33
  def initialize(controller, safe_run = false)
@@ -54,15 +58,13 @@ module Ohai
54
58
  else
55
59
  raise Ohai::Exceptions::InvalidPlugin, "Invalid plugin version #{plugin.version} for plugin #{plugin}"
56
60
  end
57
- rescue Ohai::Exceptions::Error # rubocop: disable Lint/ShadowedException
58
- raise
59
- rescue SystemExit # abort or exit from plug-in should exit Ohai with failure code
61
+ rescue Ohai::Exceptions::Error, SystemExit # SystemExit: abort or exit from plug-in should exit Ohai with failure code
60
62
  raise
61
63
  rescue Exception => e
62
64
  logger.trace("Plugin #{plugin.name} threw exception #{e.inspect} #{e.backtrace.join("\n")}")
63
65
  end
64
66
  end
65
- logger.trace("Plugin #{plugin.name} took #{elapsed} seconds to run.")
67
+ logger.trace("Plugin #{plugin.name} took #{"%f" % elapsed.truncate(6)} seconds to run.")
66
68
  end
67
69
 
68
70
  # @param [Ohai::DSL::Plugin] plugin
@@ -93,6 +95,7 @@ module Ohai
93
95
  end
94
96
 
95
97
  if dependency_providers.empty?
98
+ next_plugin.transport_connection = transport_connection
96
99
  @safe_run ? next_plugin.safe_run : next_plugin.run
97
100
  if next_plugin.failed
98
101
  @failed_plugins << next_plugin.name
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Adam Jacob (<adam@chef.io>)
3
4
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -29,7 +30,9 @@ require_relative "mixin/constant_helper"
29
30
  require_relative "provides_map"
30
31
  require_relative "hints"
31
32
  require_relative "config"
33
+ require_relative "train_transport"
32
34
  require "ffi_yajl" unless defined?(FFI_Yajl)
35
+ require "cgi" unless defined?(CGI)
33
36
 
34
37
  module Ohai
35
38
  # The class used by Ohai::Application and Chef to actually collect data
@@ -40,6 +43,7 @@ module Ohai
40
43
  attr_reader :config
41
44
  attr_reader :provides_map
42
45
  attr_reader :logger
46
+ attr_writer :transport_connection
43
47
 
44
48
  # the cli flag is used to determine if we're being constructed by
45
49
  # something like chef-client (which doesn't set this flag) and
@@ -67,7 +71,6 @@ module Ohai
67
71
  configure_logging if @cli
68
72
 
69
73
  @loader = Ohai::Loader.new(self)
70
- @runner = Ohai::Runner.new(self, true)
71
74
 
72
75
  Ohai::Hints.refresh_hints
73
76
 
@@ -75,6 +78,13 @@ module Ohai
75
78
  recursive_remove_constants(Ohai::NamedPlugin)
76
79
  end
77
80
 
81
+ def runner
82
+ @runner ||=
83
+ Ohai::Runner.new(self, true).tap do |runner|
84
+ runner.transport_connection = transport_connection unless transport_connection.nil?
85
+ end
86
+ end
87
+
78
88
  def [](key)
79
89
  @data[key]
80
90
  end
@@ -102,6 +112,13 @@ module Ohai
102
112
  @loader.load_all
103
113
  end
104
114
 
115
+ # get backend parameters for target mode
116
+ #
117
+ # @return [Train::Transport]
118
+ def transport_connection
119
+ @transport_connection ||= Ohai::TrainTransport.new(logger).build_transport&.connection
120
+ end
121
+
105
122
  # run all plugins or those that match the attribute filter is provided
106
123
  #
107
124
  # @param safe [Boolean]
@@ -111,13 +128,14 @@ module Ohai
111
128
  def run_plugins(safe = false, attribute_filter = nil)
112
129
  begin
113
130
  @provides_map.all_plugins(attribute_filter).each do |plugin|
114
- @runner.run_plugin(plugin)
131
+ runner.run_plugin(plugin)
115
132
  end
133
+ transport_connection.close unless transport_connection.nil?
116
134
  rescue Ohai::Exceptions::AttributeNotFound, Ohai::Exceptions::DependencyCycle => e
117
135
  logger.error("Encountered error while running plugins: #{e.inspect}")
118
136
  raise
119
137
  end
120
- critical_failed = Ohai::Config.ohai[:critical_plugins] & @runner.failed_plugins
138
+ critical_failed = Ohai::Config.ohai[:critical_plugins] & runner.failed_plugins
121
139
  unless critical_failed.empty?
122
140
  msg = "The following Ohai plugins marked as critical failed: #{critical_failed}"
123
141
  if @cli
@@ -139,7 +157,7 @@ module Ohai
139
157
  def run_additional_plugins(plugin_path)
140
158
  @loader.load_additional(plugin_path).each do |plugin|
141
159
  logger.trace "Running plugin #{plugin}"
142
- @runner.run_plugin(plugin)
160
+ runner.run_plugin(plugin)
143
161
  end
144
162
 
145
163
  freeze_strings!
@@ -225,5 +243,16 @@ module Ohai
225
243
  end
226
244
  visitor.call(@data)
227
245
  end
246
+
247
+ # Extract additional backend parameters from Target Mode URL.
248
+ #
249
+ # @api private
250
+ # @return [Hash]
251
+ def backend_parameters
252
+ uri = URI.parse(config[:target])
253
+ return {} unless uri.query
254
+
255
+ CGI.parse(uri.query).map { |k, v| [k.to_sym, v.first] }.to_h
256
+ end
228
257
  end
229
258
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+ # Author:: Bryan McLellan <btm@loftninjas.org>
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require "chef-config/mixin/train_transport" unless defined?(ChefConfig::Mixin::TrainTransport)
20
+
21
+ module Ohai
22
+ class TrainTransport
23
+ include ChefConfig::Mixin::TrainTransport
24
+
25
+ def config
26
+ Ohai::Config
27
+ end
28
+ end
29
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $stderr.puts "WARN: Ohai::Util::FileHelper is deprecated, please use Ohai::Mixin::Which or remove if the reference is unnecessary"
2
3
  require_relative "../mixin/which"
3
4
  module Ohai::Util
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Stafford Brunk (<stafford.brunk@gmail.com>)
3
4
  # License:: Apache License, Version 2.0
@@ -32,7 +33,7 @@ module Ohai
32
33
  IPV6_LINK_LOCAL_UNICAST_BLOCK.include?(ip) || IPV6_PRIVATE_ADDRESS_BLOCK.include?(ip)
33
34
  end
34
35
  end
35
- alias :unique_local_address? :private_address?
36
+ alias unique_local_address? private_address?
36
37
 
37
38
  def public_address?(addr)
38
39
  !private_address?(addr)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Author:: Adam Edwards (<adamed@chef.io>)
2
3
  #
3
4
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Adam Jacob (<adam@chef.io>)
3
4
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -18,5 +19,5 @@
18
19
 
19
20
  module Ohai
20
21
  OHAI_ROOT = File.expand_path(__dir__)
21
- VERSION = "16.5.4".freeze
22
+ VERSION = "16.8.1"
22
23
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $:.unshift File.expand_path("lib", __dir__)
2
3
  require "ohai/version"
3
4
 
@@ -11,7 +12,7 @@ Gem::Specification.new do |s|
11
12
  s.email = "adam@chef.io"
12
13
  s.homepage = "https://github.com/chef/ohai/"
13
14
 
14
- s.required_ruby_version = ">= 2.5"
15
+ s.required_ruby_version = ">= 2.6"
15
16
 
16
17
  s.add_dependency "chef-config", ">= 12.8", "< 17"
17
18
  s.add_dependency "chef-utils", ">= 16.0", "< 17"
@@ -23,6 +24,7 @@ Gem::Specification.new do |s|
23
24
  s.add_dependency "mixlib-log", ">= 2.0.1", "< 4.0"
24
25
  s.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0"
25
26
  s.add_dependency "plist", "~> 3.1"
27
+ s.add_dependency "train-core"
26
28
  s.add_dependency "wmi-lite", "~> 1.0"
27
29
  # Note for ohai developers: If chef-config causes you grief, try:
28
30
  # bundle install --with development
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.5.4
4
+ version: 16.8.1
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-09-17 00:00:00.000000000 Z
11
+ date: 2020-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -180,6 +180,20 @@ dependencies:
180
180
  - - "~>"
181
181
  - !ruby/object:Gem::Version
182
182
  version: '3.1'
183
+ - !ruby/object:Gem::Dependency
184
+ name: train-core
185
+ requirement: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ type: :runtime
191
+ prerelease: false
192
+ version_requirements: !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ version: '0'
183
197
  - !ruby/object:Gem::Dependency
184
198
  name: wmi-lite
185
199
  requirement: !ruby/object:Gem::Requirement
@@ -232,6 +246,7 @@ files:
232
246
  - lib/ohai/mixin/shell_out.rb
233
247
  - lib/ohai/mixin/softlayer_metadata.rb
234
248
  - lib/ohai/mixin/string.rb
249
+ - lib/ohai/mixin/train_helpers.rb
235
250
  - lib/ohai/mixin/which.rb
236
251
  - lib/ohai/plugin_config.rb
237
252
  - lib/ohai/plugins/aix/kernel.rb
@@ -270,11 +285,11 @@ files:
270
285
  - lib/ohai/plugins/gce.rb
271
286
  - lib/ohai/plugins/go.rb
272
287
  - lib/ohai/plugins/groovy.rb
288
+ - lib/ohai/plugins/grub2.rb
273
289
  - lib/ohai/plugins/haskell.rb
274
290
  - lib/ohai/plugins/hostname.rb
275
291
  - lib/ohai/plugins/init_package.rb
276
292
  - lib/ohai/plugins/java.rb
277
- - lib/ohai/plugins/joyent.rb
278
293
  - lib/ohai/plugins/kernel.rb
279
294
  - lib/ohai/plugins/keys.rb
280
295
  - lib/ohai/plugins/languages.rb
@@ -336,6 +351,7 @@ files:
336
351
  - lib/ohai/plugins/ssh_host_key.rb
337
352
  - lib/ohai/plugins/sysconf.rb
338
353
  - lib/ohai/plugins/timezone.rb
354
+ - lib/ohai/plugins/train.rb
339
355
  - lib/ohai/plugins/uptime.rb
340
356
  - lib/ohai/plugins/virtualbox.rb
341
357
  - lib/ohai/plugins/vmware.rb
@@ -350,6 +366,7 @@ files:
350
366
  - lib/ohai/provides_map.rb
351
367
  - lib/ohai/runner.rb
352
368
  - lib/ohai/system.rb
369
+ - lib/ohai/train_transport.rb
353
370
  - lib/ohai/util/file_helper.rb
354
371
  - lib/ohai/util/ip_helper.rb
355
372
  - lib/ohai/util/win32.rb
@@ -367,7 +384,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
367
384
  requirements:
368
385
  - - ">="
369
386
  - !ruby/object:Gem::Version
370
- version: '2.5'
387
+ version: '2.6'
371
388
  required_rubygems_version: !ruby/object:Gem::Requirement
372
389
  requirements:
373
390
  - - ">="